From ilan.peer  Wed Jan  1 05:32:08 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:32:08 +0200
Subject: [PATCH 0/5] Add support for CSA advertisement and testing
Message-ID: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>

The series adds support for checking driver support for CSA
and additional test cases for the testing framework (skipping csa
test cases if CSA is not supported).

Andrei Otcheretianski (4):
  wpa_supplicant: Move CS supported flag to wpa_driver_capa
  wpa_supplicant/hostapd: Add awareness of CSA support
  hostapd: Advertise CSA support in STATUS command
  hwsim: Skip CSA tests if the driver doesn't support it

Luciano Coelho (1):
  hwsim tests: Add test cases for AP channel switch announcement

 hostapd/main.c                    |    1 +
 src/ap/ctrl_iface_ap.c            |    6 ++-
 src/ap/hostapd.c                  |    8 +++
 src/ap/hostapd.h                  |    1 +
 src/drivers/driver.h              |    3 ++
 src/drivers/driver_nl80211.c      |    7 +--
 tests/hwsim/test_ap_csa.py        |  107 +++++++++++++++++++++++++++++++++++++
 wpa_supplicant/ap.c               |    1 +
 wpa_supplicant/wpa_supplicant.c   |    1 +
 wpa_supplicant/wpa_supplicant_i.h |    2 +
 10 files changed, 132 insertions(+), 5 deletions(-)
 create mode 100644 tests/hwsim/test_ap_csa.py

-- 
1.7.10.4



From ilan.peer  Wed Jan  1 05:32:09 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:32:09 +0200
Subject: [PATCH 1/5] wpa_supplicant: Move CS supported flag to wpa_driver_capa
In-Reply-To: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1388583133-14842-2-git-send-email-ilan.peer@intel.com>

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

Replace channel_switch_supported flag of the
wpa_driver_nl80211_data by WPA_DRIVER_FLAGS_AP_CSA inside
wpa_driver_capa.flags, it makes more sense and also can
be accessed by wpa_supplicant.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/drivers/driver.h         |    3 +++
 src/drivers/driver_nl80211.c |    7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index f8623d3..f593b92 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -917,6 +917,9 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE		0x20000000
 /* Driver supports QoS Mapping */
 #define WPA_DRIVER_FLAGS_QOS_MAPPING			0x40000000
+/* Driver supports CSA in AP mode*/
+#define WPA_DRIVER_FLAGS_AP_CSA				0x80000000
+
 	unsigned int flags;
 
 	int max_scan_ssids;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index e1f5860..c0a3ed4 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -300,7 +300,6 @@ struct wpa_driver_nl80211_data {
 	unsigned int hostapd:1;
 	unsigned int start_mode_ap:1;
 	unsigned int start_iface_up:1;
-	unsigned int channel_switch_supported:1;
 
 	u64 remain_on_chan_cookie;
 	u64 send_action_cookie;
@@ -3546,6 +3545,9 @@ static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv,
 	if (!drv->capa.max_remain_on_chan)
 		drv->capa.max_remain_on_chan = 5000;
 
+	if (info->channel_switch_supported)
+		drv->capa.flags |= WPA_DRIVER_FLAGS_AP_CSA;
+
 	return 0;
 nla_put_failure:
 	nlmsg_free(msg);
@@ -3588,7 +3590,6 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 	drv->device_ap_sme = info.device_ap_sme;
 	drv->poll_command_supported = info.poll_command_supported;
 	drv->data_tx_status = info.data_tx_status;
-	drv->channel_switch_supported = info.channel_switch_supported;
 	if (info.set_qos_map_supported)
 		drv->capa.flags |= WPA_DRIVER_FLAGS_QOS_MAPPING;
 
@@ -11458,7 +11459,7 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 		   settings->freq_params.center_freq1,
 		   settings->freq_params.center_freq2);
 
-	if (!drv->channel_switch_supported) {
+	if (!(drv->capa.flags & WPA_DRIVER_FLAGS_AP_CSA)) {
 		wpa_printf(MSG_DEBUG, "nl80211: Driver does not support channel switch command");
 		return -EOPNOTSUPP;
 	}
-- 
1.7.10.4



From ilan.peer  Wed Jan  1 05:32:10 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:32:10 +0200
Subject: [PATCH 2/5] wpa_supplicant/hostapd: Add awareness of CSA support
In-Reply-To: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1388583133-14842-3-git-send-email-ilan.peer@intel.com>

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

Store csa_supported flag in wpa_supplicant and hostapd_iface.
Don't start CSA flow when CSA is not supported.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 hostapd/main.c                    |    1 +
 src/ap/hostapd.c                  |    8 ++++++++
 src/ap/hostapd.h                  |    1 +
 wpa_supplicant/ap.c               |    1 +
 wpa_supplicant/wpa_supplicant.c   |    1 +
 wpa_supplicant/wpa_supplicant_i.h |    2 ++
 6 files changed, 14 insertions(+)

diff --git a/hostapd/main.c b/hostapd/main.c
index 4e9fe40..eff99ea 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -223,6 +223,7 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
 		iface->extended_capa_mask = capa.extended_capa_mask;
 		iface->extended_capa_len = capa.extended_capa_len;
 		iface->drv_max_acl_mac_addrs = capa.max_acl_mac_addrs;
+		iface->csa_supported = !!(capa.flags & WPA_DRIVER_FLAGS_AP_CSA);
 	}
 
 	return 0;
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 69459f7..3d88c59 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2232,6 +2232,14 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
 			   struct csa_settings *settings)
 {
 	int ret;
+	if (!hapd->iface)
+		return -1;
+
+	if (!hapd->iface->csa_supported) {
+		wpa_printf(MSG_ERROR, "CSA is not supported");
+		return -1;
+	}
+
 	ret = hostapd_fill_csa_settings(hapd->iface, settings);
 	if (ret)
 		return ret;
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 489ab16..e3ce3d2 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -344,6 +344,7 @@ struct hostapd_iface {
 	unsigned int cs_c_off_beacon;
 	unsigned int cs_c_off_proberesp;
 	int csa_in_progress;
+	unsigned int csa_supported:1;
 
 #ifdef CONFIG_ACS
 	unsigned int acs_num_completed_scans;
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 08a8855..86b8420 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -551,6 +551,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
 	hapd_iface->extended_capa = wpa_s->extended_capa;
 	hapd_iface->extended_capa_mask = wpa_s->extended_capa_mask;
 	hapd_iface->extended_capa_len = wpa_s->extended_capa_len;
+	hapd_iface->csa_supported = wpa_s->csa_supported;
 
 	wpa_s->ap_iface->conf = conf = hostapd_config_defaults();
 	if (conf == NULL) {
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 50436cb..add71eb 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -3160,6 +3160,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s,
 		wpa_s->extended_capa_len = capa.extended_capa_len;
 		wpa_s->num_multichan_concurrent =
 			capa.num_multichan_concurrent;
+		wpa_s->csa_supported = !!(capa.flags & WPA_DRIVER_FLAGS_AP_CSA);
 	}
 	if (wpa_s->max_remain_on_chan == 0)
 		wpa_s->max_remain_on_chan = 1000;
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 9dbf523..20dcb54 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -746,6 +746,8 @@ struct wpa_supplicant {
 #endif /* CONFIG_TESTING_GET_GTK */
 
 	unsigned int num_multichan_concurrent;
+
+	unsigned int csa_supported:1;
 };
 
 
-- 
1.7.10.4



From ilan.peer  Wed Jan  1 05:32:11 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:32:11 +0200
Subject: [PATCH 3/5] hostapd: Advertise CSA support in STATUS command
In-Reply-To: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1388583133-14842-4-git-send-email-ilan.peer@intel.com>

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

Publish the value of csa_supported flag in the STATUS
command output.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 src/ap/ctrl_iface_ap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 0d46ea0..1a52ce5 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -333,7 +333,8 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
 			  "num_sta_no_ht=%d\n"
 			  "num_sta_ht_20_mhz=%d\n"
 			  "olbc_ht=%d\n"
-			  "ht_op_mode=0x%x\n",
+			  "ht_op_mode=0x%x\n"
+			  "csa_supported=%u\n",
 			  hostapd_state_text(iface->state),
 			  iface->phy,
 			  iface->freq,
@@ -345,7 +346,8 @@ int hostapd_ctrl_iface_status(struct hostapd_data *hapd, char *buf,
 			  iface->num_sta_no_ht,
 			  iface->num_sta_ht_20mhz,
 			  iface->olbc_ht,
-			  iface->ht_op_mode);
+			  iface->ht_op_mode,
+			  iface->csa_supported);
 	if (ret < 0 || (size_t) ret >= buflen - len)
 		return len;
 	len += ret;
-- 
1.7.10.4



From ilan.peer  Wed Jan  1 05:32:12 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:32:12 +0200
Subject: [PATCH 4/5] hwsim tests: Add test cases for AP channel switch
	announcement
In-Reply-To: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1388583133-14842-5-git-send-email-ilan.peer@intel.com>

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

Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>
---
 tests/hwsim/test_ap_csa.py |   85 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 tests/hwsim/test_ap_csa.py

diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py
new file mode 100644
index 0000000..9b2feb0
--- /dev/null
+++ b/tests/hwsim/test_ap_csa.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+#
+# AP CSA  tests
+# Copyright (c) 2013, Luciano Coelho <luciano.coelho at intel.com>
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import time
+import subprocess
+import logging
+logger = logging.getLogger()
+
+import hwsim_utils
+import hostapd
+
+def connect(dev, apdev):
+    params = { "ssid": "ap-csa",
+               "channel": "1" }
+    ap = hostapd.add_ap(apdev[0]['ifname'], params)
+    dev.connect("ap-csa", key_mgmt="NONE")
+    return ap
+
+def switch_channel(ap, count, freq):
+    ap.request("CHAN_SWITCH " + str(count) + " " + str(freq))
+    ev = ap.wait_event(["AP-CSA-FINISHED"], timeout=10)
+    if ev is None:
+        raise Exception("CSA finished event timed out")
+    if "freq=" + str(freq) not in ev:
+        raise Exception("Unexpected channel in CSA finished event")
+    time.sleep(0.1)
+
+def test_ap_csa_1_switch(dev, apdev):
+    """AP Channel Switch, one switch"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches(dev, apdev):
+    """AP Channel Switch, two switches"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_1_switch_count_0(dev, apdev):
+    """AP Channel Switch, one switch with count 0"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches_count_0(dev, apdev):
+    """AP Channel Switch, two switches with count 0"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_1_switch_count_1(dev, apdev):
+    """AP Channel Switch, one switch with count 1"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches_count_1(dev, apdev):
+    """AP Channel Switch, two switches with count 1"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
-- 
1.7.10.4



From ilan.peer  Wed Jan  1 05:32:13 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:32:13 +0200
Subject: [PATCH 5/5] hwsim: Skip CSA tests if the driver doesn't support it
In-Reply-To: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1388583133-14842-6-git-send-email-ilan.peer@intel.com>

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

Check wether wpa_supplicant or hostapd on the ap interface
support channel switch announcement and skip the tests
otherwise.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 tests/hwsim/test_ap_csa.py |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py
index 9b2feb0..61ef86e 100644
--- a/tests/hwsim/test_ap_csa.py
+++ b/tests/hwsim/test_ap_csa.py
@@ -30,9 +30,21 @@ def switch_channel(ap, count, freq):
         raise Exception("Unexpected channel in CSA finished event")
     time.sleep(0.1)
 
+# This function checks wether the provided dev, which may be either
+# WpaSupplicant or Hostapd supports CSA
+def csa_supported(dev):
+    # For WpaSupplicant we check driver's capability with get_driver_status
+    if hasattr(dev, 'get_driver_status'):
+        res = dev.get_driver_status()
+        return (int(res['capa.flags'], 0) & 0x40000000) != 0
+    # Otherwise it's Hostapd and CSA support is published with STATUS command
+    return int(dev.get_status_field('csa_supported') or 0)
+
 def test_ap_csa_1_switch(dev, apdev):
     """AP Channel Switch, one switch"""
     ap = connect(dev[0], apdev)
+    if not csa_supported(ap):
+        return "skip"
 
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     switch_channel(ap, 10, 2462)
@@ -41,6 +53,8 @@ def test_ap_csa_1_switch(dev, apdev):
 def test_ap_csa_2_switches(dev, apdev):
     """AP Channel Switch, two switches"""
     ap = connect(dev[0], apdev)
+    if not csa_supported(ap):
+        return "skip"
 
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     switch_channel(ap, 10, 2462)
@@ -51,6 +65,8 @@ def test_ap_csa_2_switches(dev, apdev):
 def test_ap_csa_1_switch_count_0(dev, apdev):
     """AP Channel Switch, one switch with count 0"""
     ap = connect(dev[0], apdev)
+    if not csa_supported(ap):
+        return "skip"
 
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     switch_channel(ap, 0, 2462)
@@ -59,6 +75,8 @@ def test_ap_csa_1_switch_count_0(dev, apdev):
 def test_ap_csa_2_switches_count_0(dev, apdev):
     """AP Channel Switch, two switches with count 0"""
     ap = connect(dev[0], apdev)
+    if not csa_supported(ap):
+        return "skip"
 
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     switch_channel(ap, 0, 2462)
@@ -69,6 +87,8 @@ def test_ap_csa_2_switches_count_0(dev, apdev):
 def test_ap_csa_1_switch_count_1(dev, apdev):
     """AP Channel Switch, one switch with count 1"""
     ap = connect(dev[0], apdev)
+    if not csa_supported(ap):
+        return "skip"
 
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     switch_channel(ap, 1, 2462)
@@ -77,6 +97,8 @@ def test_ap_csa_1_switch_count_1(dev, apdev):
 def test_ap_csa_2_switches_count_1(dev, apdev):
     """AP Channel Switch, two switches with count 1"""
     ap = connect(dev[0], apdev)
+    if not csa_supported(ap):
+        return "skip"
 
     hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
     switch_channel(ap, 1, 2462)
-- 
1.7.10.4



From ilan.peer  Wed Jan  1 05:36:55 2014
From: ilan.peer (Peer, Ilan)
Date: Wed, 1 Jan 2014 13:36:55 +0000
Subject: [PATCH 4/5] hwsim tests: Add test cases for AP channel switch
	announcement
In-Reply-To: <1388583133-14842-5-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
	<1388583133-14842-5-git-send-email-ilan.peer@intel.com>
Message-ID: <CB3B3D4774441E42AA3EA0E1BA8230A0333501BB@HASMSX106.ger.corp.intel.com>

Hi,

This patch needs to be with --in-reply-to <1387050197-3183-1-git-send-email-luca at coelho.fi>
Fixing this now.

Sorry,

Ilan.

> -----Original Message-----
> From: hostap-bounces at lists.shmoo.com [mailto:hostap-
> bounces at lists.shmoo.com] On Behalf Of Ilan Peer
> Sent: Wednesday, January 01, 2014 15:32
> To: hostap at lists.shmoo.com
> Cc: Coelho, Luciano
> Subject: [PATCH 4/5] hwsim tests: Add test cases for AP channel switch
> announcement
> 
> From: Luciano Coelho <luciano.coelho at intel.com>
> 
> Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>
> ---
>  tests/hwsim/test_ap_csa.py |   85
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 85 insertions(+)
>  create mode 100644 tests/hwsim/test_ap_csa.py
> 
> diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py new
> file mode 100644 index 0000000..9b2feb0
> --- /dev/null
> +++ b/tests/hwsim/test_ap_csa.py
> @@ -0,0 +1,85 @@
> +#!/usr/bin/python
> +#
> +# AP CSA  tests
> +# Copyright (c) 2013, Luciano Coelho <luciano.coelho at intel.com> # #
> +This software may be distributed under the terms of the BSD license.
> +# See README for more details.
> +
> +import time
> +import subprocess
> +import logging
> +logger = logging.getLogger()
> +
> +import hwsim_utils
> +import hostapd
> +
> +def connect(dev, apdev):
> +    params = { "ssid": "ap-csa",
> +               "channel": "1" }
> +    ap = hostapd.add_ap(apdev[0]['ifname'], params)
> +    dev.connect("ap-csa", key_mgmt="NONE")
> +    return ap
> +
> +def switch_channel(ap, count, freq):
> +    ap.request("CHAN_SWITCH " + str(count) + " " + str(freq))
> +    ev = ap.wait_event(["AP-CSA-FINISHED"], timeout=10)
> +    if ev is None:
> +        raise Exception("CSA finished event timed out")
> +    if "freq=" + str(freq) not in ev:
> +        raise Exception("Unexpected channel in CSA finished event")
> +    time.sleep(0.1)
> +
> +def test_ap_csa_1_switch(dev, apdev):
> +    """AP Channel Switch, one switch"""
> +    ap = connect(dev[0], apdev)
> +
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 10, 2462)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +
> +def test_ap_csa_2_switches(dev, apdev):
> +    """AP Channel Switch, two switches"""
> +    ap = connect(dev[0], apdev)
> +
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 10, 2462)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 10, 2412)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +
> +def test_ap_csa_1_switch_count_0(dev, apdev):
> +    """AP Channel Switch, one switch with count 0"""
> +    ap = connect(dev[0], apdev)
> +
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 0, 2462)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +
> +def test_ap_csa_2_switches_count_0(dev, apdev):
> +    """AP Channel Switch, two switches with count 0"""
> +    ap = connect(dev[0], apdev)
> +
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 0, 2462)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 0, 2412)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +
> +def test_ap_csa_1_switch_count_1(dev, apdev):
> +    """AP Channel Switch, one switch with count 1"""
> +    ap = connect(dev[0], apdev)
> +
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 1, 2462)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +
> +def test_ap_csa_2_switches_count_1(dev, apdev):
> +    """AP Channel Switch, two switches with count 1"""
> +    ap = connect(dev[0], apdev)
> +
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 1, 2462)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> +    switch_channel(ap, 1, 2412)
> +    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
> --
> 1.7.10.4
> 
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap


From ilan.peer  Wed Jan  1 05:39:14 2014
From: ilan.peer (Ilan Peer)
Date: Wed,  1 Jan 2014 15:39:14 +0200
Subject: [PATCH 4/5] hwsim tests: Add test cases for AP channel switch
	announcement
In-Reply-To: <1387050197-3183-1-git-send-email-luca@coelho.fi>
References: <1387050197-3183-1-git-send-email-luca@coelho.fi>
Message-ID: <1388583554-15043-1-git-send-email-ilan.peer@intel.com>

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

Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>
---
 tests/hwsim/test_ap_csa.py |   85 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 tests/hwsim/test_ap_csa.py

diff --git a/tests/hwsim/test_ap_csa.py b/tests/hwsim/test_ap_csa.py
new file mode 100644
index 0000000..9b2feb0
--- /dev/null
+++ b/tests/hwsim/test_ap_csa.py
@@ -0,0 +1,85 @@
+#!/usr/bin/python
+#
+# AP CSA  tests
+# Copyright (c) 2013, Luciano Coelho <luciano.coelho at intel.com>
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import time
+import subprocess
+import logging
+logger = logging.getLogger()
+
+import hwsim_utils
+import hostapd
+
+def connect(dev, apdev):
+    params = { "ssid": "ap-csa",
+               "channel": "1" }
+    ap = hostapd.add_ap(apdev[0]['ifname'], params)
+    dev.connect("ap-csa", key_mgmt="NONE")
+    return ap
+
+def switch_channel(ap, count, freq):
+    ap.request("CHAN_SWITCH " + str(count) + " " + str(freq))
+    ev = ap.wait_event(["AP-CSA-FINISHED"], timeout=10)
+    if ev is None:
+        raise Exception("CSA finished event timed out")
+    if "freq=" + str(freq) not in ev:
+        raise Exception("Unexpected channel in CSA finished event")
+    time.sleep(0.1)
+
+def test_ap_csa_1_switch(dev, apdev):
+    """AP Channel Switch, one switch"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches(dev, apdev):
+    """AP Channel Switch, two switches"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 10, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_1_switch_count_0(dev, apdev):
+    """AP Channel Switch, one switch with count 0"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches_count_0(dev, apdev):
+    """AP Channel Switch, two switches with count 0"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 0, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_1_switch_count_1(dev, apdev):
+    """AP Channel Switch, one switch with count 1"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+
+def test_ap_csa_2_switches_count_1(dev, apdev):
+    """AP Channel Switch, two switches with count 1"""
+    ap = connect(dev[0], apdev)
+
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2462)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+    switch_channel(ap, 1, 2412)
+    hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
-- 
1.7.10.4



From greearb  Thu Jan  2 14:32:02 2014
From: greearb (greearb at candelatech.com)
Date: Thu,  2 Jan 2014 14:32:02 -0800
Subject: [PATCH] eap-sim:  Improve derived-key error message.
Message-ID: <1388701922-5785-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

This error is caused by a crypto library that does not have
proper support for the requested feature, so warn loudly
about it.

Signed-hostap: Ben Greear <greearb at candelatech.com>
---
 src/eap_common/eap_sim_common.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/eap_common/eap_sim_common.c b/src/eap_common/eap_sim_common.c
index e1773bf..f7d7ae0 100644
--- a/src/eap_common/eap_sim_common.c
+++ b/src/eap_common/eap_sim_common.c
@@ -21,7 +21,12 @@
 
 static int eap_sim_prf(const u8 *key, u8 *x, size_t xlen)
 {
-	return fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
+	int rv = fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
+	if (rv < 0) {
+		wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys: %i,"
+			   " Compiled with INVALID CRYPTO LIBRARY?", rv);
+	}
+	return rv;
 }
 
 
@@ -79,7 +84,6 @@ int eap_sim_derive_keys(const u8 *mk, u8 *k_encr, u8 *k_aut, u8 *msk, u8 *emsk)
 	u8 buf[EAP_SIM_K_ENCR_LEN + EAP_SIM_K_AUT_LEN +
 	       EAP_SIM_KEYING_DATA_LEN + EAP_EMSK_LEN], *pos;
 	if (eap_sim_prf(mk, buf, sizeof(buf)) < 0) {
-		wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys");
 		return -1;
 	}
 	pos = buf;
@@ -144,7 +148,6 @@ int eap_sim_derive_keys_reauth(u16 _counter,
 	wpa_hexdump(MSG_DEBUG, "EAP-SIM: XKEY'", xkey, SHA1_MAC_LEN);
 
 	if (eap_sim_prf(xkey, buf, sizeof(buf)) < 0) {
-		wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys");
 		return -1;
 	}
 	if (msk) {
-- 
1.8.1.4



From greearb  Thu Jan  2 14:32:15 2014
From: greearb (greearb at candelatech.com)
Date: Thu,  2 Jan 2014 14:32:15 -0800
Subject: [PATCH] libnl:  Document how to configure for libnl 2.0 and 3.2.
Message-ID: <1388701935-5824-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Reported-by: Xose Vazquez Perez <xose.vazquez at gmail.com>

Signed-hostap: Ben Greear <greearb at candelatech.com>
---
 hostapd/defconfig        | 16 ++++++++++++++++
 wpa_supplicant/defconfig | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/hostapd/defconfig b/hostapd/defconfig
index 2dd6fc8..7da7774 100644
--- a/hostapd/defconfig
+++ b/hostapd/defconfig
@@ -22,6 +22,22 @@ CONFIG_DRIVER_HOSTAP=y
 # Driver interface for drivers using the nl80211 kernel interface
 CONFIG_DRIVER_NL80211=y
 
+# driver_nl80211.c requires a rather new libnl (version 1.1) which may not be
+# shipped with your distribution yet. If that is the case, you need to build
+# newer libnl version and point the hostapd build to use it.
+#
+#LIBNLI=${FOO}/3plibs/libnl
+#LIBNLL=${FOO}/server/local
+#CFLAGS += -I$(LIBNLI)/include
+#LIBS += -L$(LIBNLL)/lib
+
+# Use libnl v2.0 libraries.
+#CONFIG_LIBNL20=y
+
+# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
+#CONFIG_LIBNL32=y
+
+
 # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
 #CONFIG_DRIVER_BSD=y
 #CFLAGS += -I/usr/local/include
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 0d2556d..e37dd8a 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -88,6 +88,22 @@ CONFIG_DRIVER_WEXT=y
 # Driver interface for Linux drivers using the nl80211 kernel interface
 CONFIG_DRIVER_NL80211=y
 
+# driver_nl80211.c requires a rather new libnl (version 1.1) which may not be
+# shipped with your distribution yet. If that is the case, you need to build
+# newer libnl version and point the hostapd build to use it.
+#
+#LIBNLI=${FOO}/3plibs/libnl
+#LIBNLL=${FOO}/server/local
+#CFLAGS += -I$(LIBNLI)/include
+#LIBS += -L$(LIBNLL)/lib
+
+# Use libnl v2.0 libraries.
+#CONFIG_LIBNL20=y
+
+# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
+#CONFIG_LIBNL32=y
+
+
 # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
 #CONFIG_DRIVER_BSD=y
 #CFLAGS += -I/usr/local/include
-- 
1.8.1.4



From greearb  Thu Jan  2 14:43:20 2014
From: greearb (Ben Greear)
Date: Thu, 02 Jan 2014 14:43:20 -0800
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <52406696.1090001@candelatech.com>
References: <1378752545-9783-1-git-send-email-greearb@candelatech.com>	<20130923080817.GD10148@w1.fi>
	<52406696.1090001@candelatech.com>
Message-ID: <52C5EB88.1090609@candelatech.com>

Any more thought on this?



On 09/23/2013 09:04 AM, Ben Greear wrote:
> On 09/23/2013 01:08 AM, Jouni Malinen wrote:
>> On Mon, Sep 09, 2013 at 11:49:04AM -0700, greearb at candelatech.com wrote:
>>> Without this patch, wpa_supplicant EAPOL packets (at least)
>>> are sent on normal best-effort TX queue.  I believe they
>>> should be on the VO high-priority queue instead.
>>
>>> diff --git a/src/l2_packet/l2_packet_linux.c b/src/l2_packet/l2_packet_linux.c
>>
>>> @@ -97,6 +97,7 @@ struct l2_packet_data * l2_packet_init(
>>> +    /* Use high-priority queue for management packets
>>> +     * http://wireless.kernel.org/en/developers/Documentation/mac80211/queues
>>> +     */
>>> +    if (setsockopt(l2->fd, SOL_SOCKET,
>>> +               SO_PRIORITY, (char*)&val, sizeof(val)) < 0) {
>>
>> This seems to be assuming that mac80211 is used always. That is not
>> really the case and I guess this SO_PRIORITY change to a special
>> mac80211-specific value could result in undesired results with
>> non-mac80211 drivers.
>
> The special priority is defined in the net/wireless/ dir of the kernel,
> and does not make special mention of mac80211 v/s other logic.
>
>  From what I can tell, there is no other way to specify QoS when
> sending on packet-sockets.  The skb->priority never hits the wire
> directly, so either something should be using it properly, or it
> will just be ignored and we are no worse off than before.  If
> some driver is actually conflicting with the documentation, then
> we just need to fix it.
>
> from net/wireless/util.c:
>
> /* Given a data frame determine the 802.1p/1d tag to use. */
> unsigned int cfg80211_classify8021d(struct sk_buff *skb)
> {
>      unsigned int dscp;
>
>      /* skb->priority values from 256->263 are magic values to
>       * directly indicate a specific 802.1d priority.  This is used
>       * to allow 802.1d priority to be passed directly in from VLAN
>       * tags, etc.
>       */
>      if (skb->priority >= 256 && skb->priority <= 263)
>          return skb->priority - 256;
>
>      switch (skb->protocol) {
>      case htons(ETH_P_IP):
>          dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc;
>          break;
>      case htons(ETH_P_IPV6):
>          dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & 0xfc;
>          break;
>      default:
>          return 0;
>      }
>
>      return dscp >> 5;
> }
> EXPORT_SYMBOL(cfg80211_classify8021d);
>
>
> Thanks,
> Ben
>


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



From dcbw  Fri Jan  3 09:02:15 2014
From: dcbw (Dan Williams)
Date: Fri, 03 Jan 2014 11:02:15 -0600
Subject: [PATCH] libnl:  Document how to configure for libnl 2.0 and 3.2.
In-Reply-To: <1388701935-5824-1-git-send-email-greearb@candelatech.com>
References: <1388701935-5824-1-git-send-email-greearb@candelatech.com>
Message-ID: <1388768535.15818.3.camel@dcbw.local>

On Thu, 2014-01-02 at 14:32 -0800, greearb at candelatech.com wrote:
> From: Ben Greear <greearb at candelatech.com>
> 
> Reported-by: Xose Vazquez Perez <xose.vazquez at gmail.com>
> 
> Signed-hostap: Ben Greear <greearb at candelatech.com>
> ---
>  hostapd/defconfig        | 16 ++++++++++++++++
>  wpa_supplicant/defconfig | 16 ++++++++++++++++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/hostapd/defconfig b/hostapd/defconfig
> index 2dd6fc8..7da7774 100644
> --- a/hostapd/defconfig
> +++ b/hostapd/defconfig
> @@ -22,6 +22,22 @@ CONFIG_DRIVER_HOSTAP=y
>  # Driver interface for drivers using the nl80211 kernel interface
>  CONFIG_DRIVER_NL80211=y
>  
> +# driver_nl80211.c requires a rather new libnl (version 1.1) which may not be

I wouldn't say libnl 1.1 is "rather new" as it was released on
2008-1-14, almost 5 years ago.  libnl2 was released in late 2010 even.
If anything, libnl3 is "rather new" but the others are not...

Dan

> +# shipped with your distribution yet. If that is the case, you need to build
> +# newer libnl version and point the hostapd build to use it.
> +#
> +#LIBNLI=${FOO}/3plibs/libnl
> +#LIBNLL=${FOO}/server/local
> +#CFLAGS += -I$(LIBNLI)/include
> +#LIBS += -L$(LIBNLL)/lib
> +
> +# Use libnl v2.0 libraries.
> +#CONFIG_LIBNL20=y
> +
> +# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
> +#CONFIG_LIBNL32=y
> +
> +
>  # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
>  #CONFIG_DRIVER_BSD=y
>  #CFLAGS += -I/usr/local/include
> diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
> index 0d2556d..e37dd8a 100644
> --- a/wpa_supplicant/defconfig
> +++ b/wpa_supplicant/defconfig
> @@ -88,6 +88,22 @@ CONFIG_DRIVER_WEXT=y
>  # Driver interface for Linux drivers using the nl80211 kernel interface
>  CONFIG_DRIVER_NL80211=y
>  
> +# driver_nl80211.c requires a rather new libnl (version 1.1) which may not be
> +# shipped with your distribution yet. If that is the case, you need to build
> +# newer libnl version and point the hostapd build to use it.
> +#
> +#LIBNLI=${FOO}/3plibs/libnl
> +#LIBNLL=${FOO}/server/local
> +#CFLAGS += -I$(LIBNLI)/include
> +#LIBS += -L$(LIBNLL)/lib
> +
> +# Use libnl v2.0 libraries.
> +#CONFIG_LIBNL20=y
> +
> +# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
> +#CONFIG_LIBNL32=y
> +
> +
>  # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
>  #CONFIG_DRIVER_BSD=y
>  #CFLAGS += -I/usr/local/include




From greearb  Fri Jan  3 16:09:22 2014
From: greearb (greearb at candelatech.com)
Date: Fri,  3 Jan 2014 16:09:22 -0800
Subject: [PATCH v2] libnl:  Document how to configure for libnl 2.0 and 3.2.
Message-ID: <1388794162-20623-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Reported-by: Xose Vazquez Perez <xose.vazquez at gmail.com>

Signed-hostap: Ben Greear <greearb at candelatech.com>
---

v2:  Make comment more generic.

 hostapd/defconfig        |   15 +++++++++++++++
 wpa_supplicant/defconfig |   15 +++++++++++++++
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/hostapd/defconfig b/hostapd/defconfig
index 2dd6fc8..7ef90a3 100644
--- a/hostapd/defconfig
+++ b/hostapd/defconfig
@@ -22,6 +22,21 @@ CONFIG_DRIVER_HOSTAP=y
 # Driver interface for drivers using the nl80211 kernel interface
 CONFIG_DRIVER_NL80211=y
 
+# driver_nl80211.c requires libnl.  If you are compiling it yourself
+# you need to point hostapd to your version of libnl
+#
+#LIBNLI=${FOO}/3plibs/libnl
+#LIBNLL=${FOO}/server/local
+#CFLAGS += -I$(LIBNLI)/include
+#LIBS += -L$(LIBNLL)/lib
+
+# Use libnl v2.0 libraries.
+#CONFIG_LIBNL20=y
+
+# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
+#CONFIG_LIBNL32=y
+
+
 # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
 #CONFIG_DRIVER_BSD=y
 #CFLAGS += -I/usr/local/include
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 0d2556d..d1a6959 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -88,6 +88,21 @@ CONFIG_DRIVER_WEXT=y
 # Driver interface for Linux drivers using the nl80211 kernel interface
 CONFIG_DRIVER_NL80211=y
 
+# driver_nl80211.c requires libnl.  If you are compiling it yourself
+# you need to point hostapd to your version of libnl
+#
+#LIBNLI=${FOO}/3plibs/libnl
+#LIBNLL=${FOO}/server/local
+#CFLAGS += -I$(LIBNLI)/include
+#LIBS += -L$(LIBNLL)/lib
+
+# Use libnl v2.0 libraries.
+#CONFIG_LIBNL20=y
+
+# Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored)
+#CONFIG_LIBNL32=y
+
+
 # Driver interface for FreeBSD net80211 layer (e.g., Atheros driver)
 #CONFIG_DRIVER_BSD=y
 #CFLAGS += -I/usr/local/include
-- 
1.7.3.4



From greearb  Fri Jan  3 16:10:16 2014
From: greearb (greearb at candelatech.com)
Date: Fri,  3 Jan 2014 16:10:16 -0800
Subject: [PATCH] Add some documentation relating to EAP-AKA.
Message-ID: <1388794216-20665-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb at candelatech.com>

Signed-hostapd: Ben Greear <greearb at candelatech.com>
---
 wpa_supplicant/defconfig           |    2 +-
 wpa_supplicant/wpa_supplicant.conf |    4 ++++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index 8c79eb6..0d2556d 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -331,7 +331,7 @@ CONFIG_PEERKEY=y
 
 # Select TLS implementation
 # openssl = OpenSSL (default)
-# gnutls = GnuTLS
+# gnutls = GnuTLS (Missing some features needed by EAP-AKA with USIM, at least)
 # internal = Internal TLSv1 implementation (experimental)
 # none = Empty template
 #CONFIG_TLS=openssl
diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
index c555ca6..0ea8fd0 100644
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -658,6 +658,8 @@ fast_reauth=1
 # identity: Identity string for EAP
 #	This field is also used to configure user NAI for
 #	EAP-PSK/PAX/SAKE/GPSK.
+#       For EAP-AKA, it is  1 | IMSI
+#       For EAP-SIM, it is  0 | IMSI
 # anonymous_identity: Anonymous identity string for EAP (to be used as the
 #	unencrypted identity with EAP types that support different tunnelled
 #	identity, e.g., EAP-TTLS). This field can also be used with
@@ -671,6 +673,8 @@ fast_reauth=1
 #	PSK) is also configured using this field. For EAP-GPSK, this is a
 #	variable length PSK. ext:<name of external password field> format can
 #	be used to indicate that the password is stored in external storage.
+#       For EAP-AKA, the syntax is K:OPc:SQN
+#       For EAP-SIM, the syntax is K:OPc
 # ca_cert: File path to CA certificate file (PEM/DER). This file can have one
 #	or more trusted CA certificates. If ca_cert and ca_path are not
 #	included, server certificate will not be verified. This is insecure and
-- 
1.7.3.4



From greearb  Fri Jan  3 16:45:26 2014
From: greearb (Ben Greear)
Date: Fri, 03 Jan 2014 16:45:26 -0800
Subject: Questions on using EAP-AKA
In-Reply-To: <20131231115734.GA16686@w1.fi>
References: <52B98EB9.1030505@candelatech.com> <20131224164333.GA8117@w1.fi>
	<52B9E816.702@candelatech.com> <20131224213406.GA644@w1.fi>
	<52C1C3AD.4040202@candelatech.com> <20131231115734.GA16686@w1.fi>
Message-ID: <52C759A6.9080700@candelatech.com>

I managed to get this working.  I had to use hostapd as the
RADIUS server.

I used hlr_auc_gw to handle the AKA authentication, using the
default config files in hostapd/ dir.

hlr_auc_gw is not smart enough to remove it's unix socket if it
already exists, by the way...but if you manually remove it then
all is good.

For anyone else trying this, this page is a big help:

http://www.codealias.info/technotes/hostapd_radius_server_configuration_howto

I plan to write up a blog post on this with specific config files
and more details someday soon-ish.

Thanks,
Ben

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



From j  Sun Jan  5 12:29:19 2014
From: j (Jouni Malinen)
Date: Sun, 5 Jan 2014 22:29:19 +0200
Subject: [PATCH 0/5] Add support for CSA advertisement and testing
In-Reply-To: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
Message-ID: <20140105202919.GA6687@w1.fi>

On Wed, Jan 01, 2014 at 03:32:08PM +0200, Ilan Peer wrote:
> The series adds support for checking driver support for CSA
> and additional test cases for the testing framework (skipping csa
> test cases if CSA is not supported).

> Andrei Otcheretianski (4):
>   wpa_supplicant: Move CS supported flag to wpa_driver_capa

Thanks, that makes sense.

>   wpa_supplicant/hostapd: Add awareness of CSA support

This looks pretty pointless since drv_flags has the same information.

>   hostapd: Advertise CSA support in STATUS command

I added STATUS-DRIVER to hostapd instead. No need for inventing
different ways of advertising this information between wpa_supplicant
and hostapd.

>   hwsim: Skip CSA tests if the driver doesn't support it

That would benefit from reordering to skip the test cases before the
initial connection. Furthermore, this was looking at an incorrect bit in
capa.flags which did not get executed, but csa_supported() would not
work as documented.

> Luciano Coelho (1):
>   hwsim tests: Add test cases for AP channel switch announcement

And the previous one needs to be merged into this one so that the
repository remains in working condition through the series.


I have a cleaned up versions of the patches in my work branch and will
push them in once there is some clear signs of this CSA functionality
getting enabled in the kernel. Or well, 1/5 could go in before that.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From ejas.sheriff  Sun Jan  5 17:38:43 2014
From: ejas.sheriff (Sheriff Manzoor)
Date: Mon, 6 Jan 2014 07:08:43 +0530
Subject: Documentation support for hostapd and wpa supplicant
Message-ID: <CAJio1Tpsi-sSrPjrUcH0MjXrVUVtwowVOMEOqbfXScLDjdpMeQ@mail.gmail.com>

Hi,
    I am new to hostapd and wpa supplicant concept.  Is there any
documentation for the hostapd and wpa supplicant? Is there any
specification that it has to follows?


I have come across the IEEE802.11 standard. Is these standard implemented
in the hostapd and wpa supplicant?


Thanks in advance
Sheriff Manzoor F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140106/72966f25/attachment.htm>


From jan.ceuleers  Sun Jan  5 23:20:15 2014
From: jan.ceuleers (Jan Ceuleers)
Date: Mon, 06 Jan 2014 08:20:15 +0100
Subject: Documentation support for hostapd and wpa supplicant
In-Reply-To: <CAJio1Tpsi-sSrPjrUcH0MjXrVUVtwowVOMEOqbfXScLDjdpMeQ@mail.gmail.com>
References: <CAJio1Tpsi-sSrPjrUcH0MjXrVUVtwowVOMEOqbfXScLDjdpMeQ@mail.gmail.com>
Message-ID: <52CA592F.4010600@computer.org>

On 01/06/2014 02:38 AM, Sheriff Manzoor wrote:
> Hi,
>     I am new to hostapd and wpa supplicant concept.  Is there any
> documentation for the hostapd and wpa supplicant? Is there any
> specification that it has to follows? 
> 
> 
> I have come across the IEEE802.11 standard. Is these standard
> implemented in the hostapd and wpa supplicant?

Please visit http://w1.fi

The documentation, in increasing amounts of detail, is contained in:

- the hostapd and wpa_supplicant pages at the above website;
- the README files linked to there;
- the sample configuration files included in the distribution;
- the source code.



From jan.ceuleers  Mon Jan  6 09:54:36 2014
From: jan.ceuleers (Jan Ceuleers)
Date: Mon, 06 Jan 2014 18:54:36 +0100
Subject: Documentation support for hostapd and wpa supplicant
In-Reply-To: <CAJio1TqZjELpm8HJtDecj5+qJEy9oQV=GDEZV+iGPBsR2oRRFQ@mail.gmail.com>
References: <CAJio1Tpsi-sSrPjrUcH0MjXrVUVtwowVOMEOqbfXScLDjdpMeQ@mail.gmail.com>	<52CA592F.4010600@computer.org>
	<CAJio1TqZjELpm8HJtDecj5+qJEy9oQV=GDEZV+iGPBsR2oRRFQ@mail.gmail.com>
Message-ID: <52CAEDDC.6050706@computer.org>

On 01/06/2014 06:08 PM, Sheriff Manzoor wrote:
> Thanks Jan Ceuleers,
>  
>                          May I know how much of the IEEE802.11 standard
> has been implemented in the Hostapd and Wpa supplicant source code? 
> Since the MLME for AP is done in Hostapd , what is the functionality of
> the MAC layer ?
>  
> Regards
> Sheriff Manzoor F

Please keep the list copied.

Your questions are answered to a very large extent by the README files.
Please browse through those and then feel free to ask more specific
questions.

On the list though; I'm just a sysadmin who uses hostapd so am unlikely
to be able to personally answer any specific questions you may have.

Jan


From j  Tue Jan  7 05:28:37 2014
From: j (Jouni Malinen)
Date: Tue, 7 Jan 2014 15:28:37 +0200
Subject: [PATCH] Add some documentation relating to EAP-AKA.
In-Reply-To: <1388794216-20665-1-git-send-email-greearb@candelatech.com>
References: <1388794216-20665-1-git-send-email-greearb@candelatech.com>
Message-ID: <20140107132837.GA6248@w1.fi>

On Fri, Jan 03, 2014 at 04:10:16PM -0800, greearb at candelatech.com wrote:
> diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
> -# gnutls = GnuTLS
> +# gnutls = GnuTLS (Missing some features needed by EAP-AKA with USIM, at least)

This is not exactly complete and I would much rather make this work with
EAP-SIM and EAP-AKA or make the build fail than expect people to notice
and understand this note in defconfig.

> diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
> @@ -658,6 +658,8 @@ fast_reauth=1
>  # identity: Identity string for EAP
>  #	This field is also used to configure user NAI for
>  #	EAP-PSK/PAX/SAKE/GPSK.
> +#       For EAP-AKA, it is  1 | IMSI
> +#       For EAP-SIM, it is  0 | IMSI

That is not correct. EAP-SIM does normally (but not always!) use 1 as
the prefix and EAP-AKA uses 0 (again, not always). Anyway, these would
not normally be configured by users since the identity is generated
automatically based on IMSI read from SIM/USIM. In other words, these
prefixes are reversed and only used in some test scenarios with
simulated SIM/USIM and as such, I don't think it is appropriate to
document these in this style. Furthermore, this is not really even
complete since the realm part is not included. I would be fine listing
the examples for software simulated version if they are marked as such
(and well, obviously, if they are correct).

>  # anonymous_identity: Anonymous identity string for EAP (to be used as the
>  #	unencrypted identity with EAP types that support different tunnelled
>  #	identity, e.g., EAP-TTLS). This field can also be used with
> @@ -671,6 +673,8 @@ fast_reauth=1
>  #	PSK) is also configured using this field. For EAP-GPSK, this is a
>  #	variable length PSK. ext:<name of external password field> format can
>  #	be used to indicate that the password is stored in external storage.
> +#       For EAP-AKA, the syntax is K:OPc:SQN
> +#       For EAP-SIM, the syntax is K:OPc

Again, this is very much for special corner cases. This would never be
used in normal EAP-SIM/AKA cases.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan  7 05:39:09 2014
From: j (Jouni Malinen)
Date: Tue, 7 Jan 2014 15:39:09 +0200
Subject: [PATCH] eap-sim:  Improve derived-key error message.
In-Reply-To: <1388701922-5785-1-git-send-email-greearb@candelatech.com>
References: <1388701922-5785-1-git-send-email-greearb@candelatech.com>
Message-ID: <20140107133909.GB6248@w1.fi>

On Thu, Jan 02, 2014 at 02:32:02PM -0800, greearb at candelatech.com wrote:
> This error is caused by a crypto library that does not have
> proper support for the requested feature, so warn loudly
> about it.

That is not the only reason for this failure and anyway, all the
eap_sim_prf() callers are already using MSG_ERROR level message
displaying the failure.

> diff --git a/src/eap_common/eap_sim_common.c b/src/eap_common/eap_sim_common.c
>  static int eap_sim_prf(const u8 *key, u8 *x, size_t xlen)
>  {
> -	return fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
> +	int rv = fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
> +	if (rv < 0) {
> +		wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys: %i,"
> +			   " Compiled with INVALID CRYPTO LIBRARY?", rv);

I don't think this would that helpful way of addressing this. Better
fixes would be to add support for it in GnuTLS case or prevent that
build.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan  7 05:42:08 2014
From: j (Jouni Malinen)
Date: Tue, 7 Jan 2014 15:42:08 +0200
Subject: [PATCH v2] libnl:  Document how to configure for libnl 2.0 and
	3.2.
In-Reply-To: <1388794162-20623-1-git-send-email-greearb@candelatech.com>
References: <1388794162-20623-1-git-send-email-greearb@candelatech.com>
Message-ID: <20140107134208.GC6248@w1.fi>

On Fri, Jan 03, 2014 at 04:09:22PM -0800, greearb at candelatech.com wrote:
> v2:  Make comment more generic.
> 
>  hostapd/defconfig        |   15 +++++++++++++++
>  wpa_supplicant/defconfig |   15 +++++++++++++++

Thanks, I'll apply this with a bit different text:

> +# driver_nl80211.c requires libnl.  If you are compiling it yourself
> +# you need to point hostapd to your version of libnl
> +#
> +#LIBNLI=${FOO}/3plibs/libnl
> +#LIBNLL=${FOO}/server/local
> +#CFLAGS += -I$(LIBNLI)/include
> +#LIBS += -L$(LIBNLL)/lib

These paths look quite confusing to me since I'd first attempt to
replace the ${FOO} path with libnl installation root directory and that
would result in the paths being incorrect since 3plibs and server/local
here look very much specific to some non-common case (i.e., "make
install" in libnl would not do that by default).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan  7 06:00:02 2014
From: j (Jouni Malinen)
Date: Tue, 7 Jan 2014 16:00:02 +0200
Subject: [PATCH] bsd: Prepare event buffer on init process
In-Reply-To: <CAFk-A4mOQbaYMVrA73si5Q2nRQoxCGXugOqirdcOYrftEz=q8g@mail.gmail.com>
References: <CAFk-A4=jqFXmjfCkmfAUG4BxE6a6jUx-gUOQm++dcFUfAbndCA@mail.gmail.com>
	<20131223181524.GB8101@w1.fi>
	<CAFk-A4mOQbaYMVrA73si5Q2nRQoxCGXugOqirdcOYrftEz=q8g@mail.gmail.com>
Message-ID: <20140107140002.GA6999@w1.fi>

On Tue, Dec 24, 2013 at 08:56:57AM +0900, Masashi Honma wrote:
> Anyway I attached the patch.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From ilan.peer  Tue Jan  7 06:04:33 2014
From: ilan.peer (Peer, Ilan)
Date: Tue, 7 Jan 2014 14:04:33 +0000
Subject: [PATCH 0/5] Add support for CSA advertisement and testing
In-Reply-To: <20140105202919.GA6687@w1.fi>
References: <1388583133-14842-1-git-send-email-ilan.peer@intel.com>
	<20140105202919.GA6687@w1.fi>
Message-ID: <CB3B3D4774441E42AA3EA0E1BA8230A0333532B7@HASMSX106.ger.corp.intel.com>

 
> That would benefit from reordering to skip the test cases before the initial
> connection. Furthermore, this was looking at an incorrect bit in capa.flags
> which did not get executed, but csa_supported() would not work as
> documented.
> 

Sorry, we tested this using an older version which did not include WPA_DRIVER_FLAGS_QOS_MAPPING. Will try to make such mistakes in the future.

> I have a cleaned up versions of the patches in my work branch and will push
> them in once there is some clear signs of this CSA functionality getting
> enabled in the kernel. Or well, 1/5 could go in before that.

Thanks. Agree on the other comments above. Sorry if this caused more work for u :)

Ilan.


From j  Tue Jan  7 06:07:16 2014
From: j (Jouni Malinen)
Date: Tue, 7 Jan 2014 16:07:16 +0200
Subject: [PATCH 6/8] P2P: cancel action frame offchan wait after recv go
	neg resp
In-Reply-To: <1387447410-8101-6-git-send-email-arik@wizery.com>
References: <1387447410-8101-1-git-send-email-arik@wizery.com>
	<1387447410-8101-6-git-send-email-arik@wizery.com>
Message-ID: <20140107140716.GA7202@w1.fi>

On Thu, Dec 19, 2013 at 12:03:28PM +0200, Arik Nemtsov wrote:
> From: Eyal Shapira <eyal at wizery.com>
> A wait of 200ms is configured after sending the go neg request.
> The go neg process can end quickly within less than 200ms. If this wait
> isn't canceled it can cause the beaconing of the GO to start while
> mac80211 is still off channel on the listen channel and this may cause
> beaconing on the wrong channel if oper channel is different from
> the listen channel.

> diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
> @@ -852,6 +852,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
>  	dev->flags &= ~P2P_DEV_WAIT_GO_NEG_RESPONSE;
> +	p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
>  
>  	if (msg.dialog_token != dev->dialog_token) {

This does not look correct.. This would result in a possible
remain-on-channel operation to be canceled before sending GO Negotiation
Confirm and as such, forcing that frame to be sent from another
remain-on-channel command which could add considerable extra latency
here.

> @@ -878,7 +879,6 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
>  			p2p_dbg(p2p, "Stop GO Negotiation attempt");
>  			p2p_go_neg_failed(p2p, dev, *msg.status);
>  		}
> -		p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
>  		p2p_parse_free(&msg);
>  		return;
>  	}

This looks like a correct place to call send_action_done(), so removing
it from here does not look valid..
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan  7 06:10:58 2014
From: j (Jouni Malinen)
Date: Tue, 7 Jan 2014 16:10:58 +0200
Subject: [PATCH 7/8] P2P: cancel action frame offchan wait after recv go
	neg conf
In-Reply-To: <1387447410-8101-7-git-send-email-arik@wizery.com>
References: <1387447410-8101-1-git-send-email-arik@wizery.com>
	<1387447410-8101-7-git-send-email-arik@wizery.com>
Message-ID: <20140107141058.GB7202@w1.fi>

On Thu, Dec 19, 2013 at 12:03:29PM +0200, Arik Nemtsov wrote:
> From: Eyal Shapira <eyal at wizery.com>
> The missing call to scan_action_done keeps us offchan
> on the listen channel for 250ms following sending go neg resp.
> In case the oper channel is different from the listen channel
> and we're GO a race could lead to start beaconing while offchan.
> This causes the beacons to go out on the listen channel instead
> of the oper channel.

This looks like a reasonable thing to address..

>  src/p2p/p2p_go_neg.c | 1 +
> diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
> @@ -1057,6 +1057,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
>  
>  	p2p_dbg(p2p, "Received GO Negotiation Confirm from " MACSTR,
>  		MAC2STR(sa));
> +	p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
>  	dev = p2p_get_device(p2p, sa);
>  	if (dev == NULL || dev->wps_method == WPS_NOT_READY ||
>  	    dev != p2p->go_neg_peer) {

.. but this seems to be too early in the function. We should not change
our state for the cases where the received frame is to be dropped
silently. Moving this down a bit to the place where
P2P_DEV_WAIT_GO_NEG_CONFIRM is cleared would be better, I think. I'll
apply this with such change and see how that goes through the tests.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From johannes  Tue Jan  7 06:59:49 2014
From: johannes (Johannes Berg)
Date: Tue, 07 Jan 2014 15:59:49 +0100
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <52406696.1090001@candelatech.com>
References: <1378752545-9783-1-git-send-email-greearb@candelatech.com>
	<20130923080817.GD10148@w1.fi> <52406696.1090001@candelatech.com>
Message-ID: <1389106789.4645.3.camel@jlt4.sipsolutions.net>

On Mon, 2013-09-23 at 09:04 -0700, Ben Greear wrote:
> On 09/23/2013 01:08 AM, Jouni Malinen wrote:
> > On Mon, Sep 09, 2013 at 11:49:04AM -0700, greearb at candelatech.com wrote:
> >> Without this patch, wpa_supplicant EAPOL packets (at least)
> >> are sent on normal best-effort TX queue.  I believe they
> >> should be on the VO high-priority queue instead.
> >
> >> diff --git a/src/l2_packet/l2_packet_linux.c b/src/l2_packet/l2_packet_linux.c
> >
> >> @@ -97,6 +97,7 @@ struct l2_packet_data * l2_packet_init(
> >> +	/* Use high-priority queue for management packets
> >> +	 * http://wireless.kernel.org/en/developers/Documentation/mac80211/queues
> >> +	 */
> >> +	if (setsockopt(l2->fd, SOL_SOCKET,
> >> +		       SO_PRIORITY, (char*)&val, sizeof(val)) < 0) {
> >
> > This seems to be assuming that mac80211 is used always. That is not
> > really the case and I guess this SO_PRIORITY change to a special
> > mac80211-specific value could result in undesired results with
> > non-mac80211 drivers.
> 
> The special priority is defined in the net/wireless/ dir of the kernel,
> and does not make special mention of mac80211 v/s other logic.
> 
>  From what I can tell, there is no other way to specify QoS when
> sending on packet-sockets.  The skb->priority never hits the wire
> directly, so either something should be using it properly, or it
> will just be ignored and we are no worse off than before.  If
> some driver is actually conflicting with the documentation, then
> we just need to fix it.

That code isn't really documentation though :)

johannes



From greearb  Tue Jan  7 10:04:57 2014
From: greearb (Ben Greear)
Date: Tue, 07 Jan 2014 10:04:57 -0800
Subject: [PATCH] eap-sim:  Improve derived-key error message.
In-Reply-To: <20140107133909.GB6248@w1.fi>
References: <1388701922-5785-1-git-send-email-greearb@candelatech.com>
	<20140107133909.GB6248@w1.fi>
Message-ID: <52CC41C9.2030409@candelatech.com>

On 01/07/2014 05:39 AM, Jouni Malinen wrote:
> On Thu, Jan 02, 2014 at 02:32:02PM -0800, greearb at candelatech.com wrote:
>> This error is caused by a crypto library that does not have
>> proper support for the requested feature, so warn loudly
>> about it.
> 
> That is not the only reason for this failure and anyway, all the
> eap_sim_prf() callers are already using MSG_ERROR level message
> displaying the failure.

I replaced two identical messages with a single message
with some extra information about why the error might
happen.  It took quite a while for me to find that one
small line of text and figure out it was indicating the problem,
and more searching around in the code before I could figure out why.

At least for the encryption libraries I looked at, that
method cannot fail except when it is not implemented at
all.

>> diff --git a/src/eap_common/eap_sim_common.c b/src/eap_common/eap_sim_common.c
>>  static int eap_sim_prf(const u8 *key, u8 *x, size_t xlen)
>>  {
>> -	return fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
>> +	int rv = fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
>> +	if (rv < 0) {
>> +		wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys: %i,"
>> +			   " Compiled with INVALID CRYPTO LIBRARY?", rv);
> 
> I don't think this would that helpful way of addressing this. Better
> fixes would be to add support for it in GnuTLS case or prevent that
> build.

A build-time failure would be better, but I haven't had time to work
on that yet.

Thanks,
Ben

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



From greearb  Tue Jan  7 10:12:35 2014
From: greearb (Ben Greear)
Date: Tue, 07 Jan 2014 10:12:35 -0800
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <1389106789.4645.3.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>
Message-ID: <52CC4393.8010304@candelatech.com>

On 01/07/2014 06:59 AM, Johannes Berg wrote:
> On Mon, 2013-09-23 at 09:04 -0700, Ben Greear wrote:
>> On 09/23/2013 01:08 AM, Jouni Malinen wrote:
>>> On Mon, Sep 09, 2013 at 11:49:04AM -0700, greearb at candelatech.com wrote:
>>>> Without this patch, wpa_supplicant EAPOL packets (at least)
>>>> are sent on normal best-effort TX queue.  I believe they
>>>> should be on the VO high-priority queue instead.
>>>
>>>> diff --git a/src/l2_packet/l2_packet_linux.c b/src/l2_packet/l2_packet_linux.c
>>>
>>>> @@ -97,6 +97,7 @@ struct l2_packet_data * l2_packet_init(
>>>> +	/* Use high-priority queue for management packets
>>>> +	 * http://wireless.kernel.org/en/developers/Documentation/mac80211/queues
>>>> +	 */
>>>> +	if (setsockopt(l2->fd, SOL_SOCKET,
>>>> +		       SO_PRIORITY, (char*)&val, sizeof(val)) < 0) {
>>>
>>> This seems to be assuming that mac80211 is used always. That is not
>>> really the case and I guess this SO_PRIORITY change to a special
>>> mac80211-specific value could result in undesired results with
>>> non-mac80211 drivers.
>>
>> The special priority is defined in the net/wireless/ dir of the kernel,
>> and does not make special mention of mac80211 v/s other logic.
>>
>>  From what I can tell, there is no other way to specify QoS when
>> sending on packet-sockets.  The skb->priority never hits the wire
>> directly, so either something should be using it properly, or it
>> will just be ignored and we are no worse off than before.  If
>> some driver is actually conflicting with the documentation, then
>> we just need to fix it.
> 
> That code isn't really documentation though :)

This page mentions it as well, about half way down.

http://wireless.kernel.org/en/developers/Documentation/mac80211/queues

As is, unless the NIC has firmware that inspects packets and
twiddles the queue selection based on that, some management packets do not go
out in the VO queue.

With my patch, it (ath9k) seems to work properly.

If someone has a suggestion for how to do this better,
please let me know.

Thanks,
Ben


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



From greearb  Tue Jan  7 10:17:42 2014
From: greearb (Ben Greear)
Date: Tue, 07 Jan 2014 10:17:42 -0800
Subject: [PATCH v2] libnl:  Document how to configure for libnl 2.0 and
	3.2.
In-Reply-To: <20140107134208.GC6248@w1.fi>
References: <1388794162-20623-1-git-send-email-greearb@candelatech.com>
	<20140107134208.GC6248@w1.fi>
Message-ID: <52CC44C6.1040901@candelatech.com>

On 01/07/2014 05:42 AM, Jouni Malinen wrote:
> On Fri, Jan 03, 2014 at 04:09:22PM -0800, greearb at candelatech.com wrote:
>> v2:  Make comment more generic.
>>
>>  hostapd/defconfig        |   15 +++++++++++++++
>>  wpa_supplicant/defconfig |   15 +++++++++++++++
> 
> Thanks, I'll apply this with a bit different text:
> 
>> +# driver_nl80211.c requires libnl.  If you are compiling it yourself
>> +# you need to point hostapd to your version of libnl
>> +#
>> +#LIBNLI=${FOO}/3plibs/libnl
>> +#LIBNLL=${FOO}/server/local
>> +#CFLAGS += -I$(LIBNLI)/include
>> +#LIBS += -L$(LIBNLL)/lib
> 
> These paths look quite confusing to me since I'd first attempt to
> replace the ${FOO} path with libnl installation root directory and that
> would result in the paths being incorrect since 3plibs and server/local
> here look very much specific to some non-common case (i.e., "make
> install" in libnl would not do that by default).

Ok, I can see how that is confusing.  It does pertain to my
particular setup.  In general, I found compiling libnl,
iw, hostapd, kernel and related tools a twisty maze of little details
and ended up compiling them in completely non-standard locations
to make it easier to not mix things with the host OS's libraries.

Thanks,
Ben


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



From ebeaudoin  Tue Jan  7 10:18:03 2014
From: ebeaudoin (Eric Beaudoin)
Date: Tue, 7 Jan 2014 13:18:03 -0500
Subject: Willing to subsidize support of 802.1x 2010 in wpa_supplicant
Message-ID: <265ED5BA1B926340AF277A54E6A83414DB3F055601@exchange.media5corp.com>

Hello,

I work for Media5 and some of our customers would like to use our boxes in a
802.1x 2010/MACsec environment.
So we are ready to subsidize ($$$) the development and testing of 802.1x
protocol version 3.

Anyone interested in providing the modified wpa_supplicant code and some
integration support can contact me directly at "hostap media5corp com".

P.S: Our goal is to implement 802.1ae (MACsec) so we are open to proposals
in that area as well.
P.P.S: New code must be under BSD license.

Regards,
 
Eric Beaudoin
Product Architect 
Media5 Corporation

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6313 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140107/aa21e893/attachment.bin>


From greearb  Tue Jan  7 10:23:15 2014
From: greearb (Ben Greear)
Date: Tue, 07 Jan 2014 10:23:15 -0800
Subject: [PATCH] Add some documentation relating to EAP-AKA.
In-Reply-To: <20140107132837.GA6248@w1.fi>
References: <1388794216-20665-1-git-send-email-greearb@candelatech.com>
	<20140107132837.GA6248@w1.fi>
Message-ID: <52CC4613.4020202@candelatech.com>

On 01/07/2014 05:28 AM, Jouni Malinen wrote:
> On Fri, Jan 03, 2014 at 04:10:16PM -0800, greearb at candelatech.com wrote:
>> diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
>> -# gnutls = GnuTLS
>> +# gnutls = GnuTLS (Missing some features needed by EAP-AKA with USIM, at least)
> 
> This is not exactly complete and I would much rather make this work with
> EAP-SIM and EAP-AKA or make the build fail than expect people to notice
> and understand this note in defconfig.
> 
>> diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf
>> @@ -658,6 +658,8 @@ fast_reauth=1
>>  # identity: Identity string for EAP
>>  #	This field is also used to configure user NAI for
>>  #	EAP-PSK/PAX/SAKE/GPSK.
>> +#       For EAP-AKA, it is  1 | IMSI
>> +#       For EAP-SIM, it is  0 | IMSI
> 
> That is not correct. EAP-SIM does normally (but not always!) use 1 as
> the prefix and EAP-AKA uses 0 (again, not always). Anyway, these would
> not normally be configured by users since the identity is generated
> automatically based on IMSI read from SIM/USIM. In other words, these
> prefixes are reversed and only used in some test scenarios with
> simulated SIM/USIM and as such, I don't think it is appropriate to
> document these in this style. Furthermore, this is not really even
> complete since the realm part is not included. I would be fine listing
> the examples for software simulated version if they are marked as such
> (and well, obviously, if they are correct).
> 
>>  # anonymous_identity: Anonymous identity string for EAP (to be used as the
>>  #	unencrypted identity with EAP types that support different tunnelled
>>  #	identity, e.g., EAP-TTLS). This field can also be used with
>> @@ -671,6 +673,8 @@ fast_reauth=1
>>  #	PSK) is also configured using this field. For EAP-GPSK, this is a
>>  #	variable length PSK. ext:<name of external password field> format can
>>  #	be used to indicate that the password is stored in external storage.
>> +#       For EAP-AKA, the syntax is K:OPc:SQN
>> +#       For EAP-SIM, the syntax is K:OPc
> 
> Again, this is very much for special corner cases. This would never be
> used in normal EAP-SIM/AKA cases.

I did screw up the 1 vs 0 for AKA and SIM.  I'll clean this up and
repost for consideration, even if just to help the next person who
searches the web.

The best info I could find previously was this link, and it
is missing some details as well:

http://comments.gmane.org/gmane.linux.drivers.hostap/24684

Thanks,
Ben

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



From masashi.honma  Tue Jan  7 23:01:49 2014
From: masashi.honma (Masashi Honma)
Date: Wed, 8 Jan 2014 16:01:49 +0900
Subject: [PATCH] eap-sim: Improve derived-key error message.
In-Reply-To: <52CC41C9.2030409@candelatech.com>
References: <1388701922-5785-1-git-send-email-greearb@candelatech.com>
	<20140107133909.GB6248@w1.fi> <52CC41C9.2030409@candelatech.com>
Message-ID: <CAFk-A4kSPjxFXoVbTT9vQ1nE-zNXgn2c+JPwp46V-om1DiEjjg@mail.gmail.com>

2014/1/8 Ben Greear <greearb at candelatech.com>:
> A build-time failure would be better, but I haven't had time to work
> on that yet.

I made an attached patch for this.

[PATCH] EAP-SIM: Prevent build for invalid TLS implementation

Currently EAP-SIM could not be used with GnuTLS, Microsoft CryptoAPI and NSS.
So prevent build by #error.

Signed-hostap: Masashi Honma <masashi.honma at gmail.com>

Regards,
Masashi Honma.

2014/1/8 Ben Greear <greearb at candelatech.com>:
> On 01/07/2014 05:39 AM, Jouni Malinen wrote:
>> On Thu, Jan 02, 2014 at 02:32:02PM -0800, greearb at candelatech.com wrote:
>>> This error is caused by a crypto library that does not have
>>> proper support for the requested feature, so warn loudly
>>> about it.
>>
>> That is not the only reason for this failure and anyway, all the
>> eap_sim_prf() callers are already using MSG_ERROR level message
>> displaying the failure.
>
> I replaced two identical messages with a single message
> with some extra information about why the error might
> happen.  It took quite a while for me to find that one
> small line of text and figure out it was indicating the problem,
> and more searching around in the code before I could figure out why.
>
> At least for the encryption libraries I looked at, that
> method cannot fail except when it is not implemented at
> all.
>
>>> diff --git a/src/eap_common/eap_sim_common.c b/src/eap_common/eap_sim_common.c
>>>  static int eap_sim_prf(const u8 *key, u8 *x, size_t xlen)
>>>  {
>>> -    return fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
>>> +    int rv = fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
>>> +    if (rv < 0) {
>>> +            wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys: %i,"
>>> +                       " Compiled with INVALID CRYPTO LIBRARY?", rv);
>>
>> I don't think this would that helpful way of addressing this. Better
>> fixes would be to add support for it in GnuTLS case or prevent that
>> build.
>
> A build-time failure would be better, but I haven't had time to work
> on that yet.
>
> Thanks,
> Ben
>
> --
> Ben Greear <greearb at candelatech.com>
> Candela Technologies Inc  http://www.candelatech.com
>
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 1212 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140108/51f35b73/attachment-0001.obj>


From oussama.stiti  Wed Jan  8 01:43:16 2014
From: oussama.stiti (Oussama Stiti)
Date: Wed, 8 Jan 2014 10:43:16 +0100
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
Message-ID: <CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>

I have added to my hostapd.conf : " vendor_elements=506f9a" and my hostapd
deamon doesn't work anymore, it displays me:
>Failed to set beacon parameters
>handle_probe_req: send: Resource temporarily unavailable

Is it the right way to add the WiFi Alliance Vendor Specific attributes?
 Thank you


2013/12/28 Scott Armitage <s.p.armitage at scottarmitage.eu>

>
> On 27 Dec 2013, at 23:35, Oussama Stiti <oussama.stiti at gmail.com> wrote:
>
> > Hi,
> >
> > Interworking (802.11u) is present, but for the WiFi Alliance Vendor
> Specific attributes (50-6f-9a) no, what is it ?
> > Thank you.
> >
>
> That is the Vendor Specific attribute for Hotspot 2.0.
>
>


-- 
*Oussama Stiti*

PhD Candidate in Computer Science, LIP6, Universit? Pierre et Marie Curie.
Paris.
Telecommunications R&D engineer at VirtuOR (www.virtuor.fr)

UPMC - LIP6
Couloir 25-26, ?tage 3, Bureau 316
4 place Jussieu
75252 PARIS CEDEX 05
Tel: 01 44 27 87 86

email: oussama.stiti at gmail.com
skype: stiti.oussama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140108/60b6b333/attachment.htm>


From janusz.dziedzic  Wed Jan  8 02:27:47 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Wed,  8 Jan 2014 11:27:47 +0100
Subject: [PATCH 1/2] hostapd: DFS/CSA check if CSA in progress
Message-ID: <1389176868-6610-1-git-send-email-janusz.dziedzic@tieto.com>

Check if CSA is already in progress, before
trigger new channel switch.

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

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index caf4092..7ee829a 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -680,14 +680,17 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 	struct hostapd_data *hapd = iface->bss[0];
 	int err = 1;
 
-	wpa_printf(MSG_DEBUG, "%s called (CAC active: %s)", __func__,
-		   iface->cac_started ? "yes" : "no");
+	wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)", __func__,
+		   iface->cac_started ? "yes" : "no", iface->csa_in_progress ? "yes" : "no");
+
+	/* Check if CSA in progress */
+	if (iface->csa_in_progress)
+		return 0;
 
 	/* Check if active CAC */
 	if (iface->cac_started)
 		return hostapd_dfs_start_channel_switch_cac(iface);
 
-
 	/* Perform channel switch/CSA */
 	channel = dfs_get_valid_channel(iface, &secondary_channel,
 					&vht_oper_centr_freq_seg0_idx,
-- 
1.7.9.5



From janusz.dziedzic  Wed Jan  8 02:27:48 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Wed,  8 Jan 2014 11:27:48 +0100
Subject: [PATCH 2/2] hostapd: DFS setup seg0 correctly for HT40-
In-Reply-To: <1389176868-6610-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1389176868-6610-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <1389176868-6610-2-git-send-email-janusz.dziedzic@tieto.com>

After we will get RADAR event we always
choose HT40+ in case HT40+/HT40- was configured.
Fix seg0 calculation.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/ap/dfs.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 7ee829a..154bc34 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -189,10 +189,9 @@ static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface,
 
 	switch (iface->conf->vht_oper_chwidth) {
 	case VHT_CHANWIDTH_USE_HT:
-		if (iface->conf->secondary_channel == 1)
+		/* Currently we always choose HT40+ */
+		if (iface->conf->secondary_channel)
 			*vht_oper_centr_freq_seg0_idx = chan->chan + 2;
-		else if (iface->conf->secondary_channel == -1)
-			*vht_oper_centr_freq_seg0_idx = chan->chan - 2;
 		else
 			*vht_oper_centr_freq_seg0_idx = chan->chan;
 		break;
-- 
1.7.9.5



From janusz.dziedzic  Wed Jan  8 02:43:16 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Wed, 8 Jan 2014 11:43:16 +0100
Subject: [PATCH 2/2] hostapd: DFS setup seg0 correctly for HT40-
In-Reply-To: <1389176868-6610-2-git-send-email-janusz.dziedzic@tieto.com>
References: <1389176868-6610-1-git-send-email-janusz.dziedzic@tieto.com>
	<1389176868-6610-2-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <CALhHN=qbAo_g3OLPufjWiJEwDjo7sJ_jTJp2bc7i-EGtKMzSng@mail.gmail.com>

Please skip this one, will be new version.

BR
Janusz

On 8 January 2014 11:27, Janusz Dziedzic <janusz.dziedzic at tieto.com> wrote:
> After we will get RADAR event we always
> choose HT40+ in case HT40+/HT40- was configured.
> Fix seg0 calculation.
>
> Signed-hostap: Janusz Dziedzic <janusz.dziedzic at tieto.com>
> ---
>  src/ap/dfs.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/ap/dfs.c b/src/ap/dfs.c
> index 7ee829a..154bc34 100644
> --- a/src/ap/dfs.c
> +++ b/src/ap/dfs.c
> @@ -189,10 +189,9 @@ static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface,
>
>         switch (iface->conf->vht_oper_chwidth) {
>         case VHT_CHANWIDTH_USE_HT:
> -               if (iface->conf->secondary_channel == 1)
> +               /* Currently we always choose HT40+ */
> +               if (iface->conf->secondary_channel)
>                         *vht_oper_centr_freq_seg0_idx = chan->chan + 2;
> -               else if (iface->conf->secondary_channel == -1)
> -                       *vht_oper_centr_freq_seg0_idx = chan->chan - 2;
>                 else
>                         *vht_oper_centr_freq_seg0_idx = chan->chan;
>                 break;
> --
> 1.7.9.5
>


From janusz.dziedzic  Wed Jan  8 03:24:11 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Wed,  8 Jan 2014 12:24:11 +0100
Subject: [PATCH v2] hostapd: DFS setup seg0 correctly for HT40-
Message-ID: <1389180251-7535-1-git-send-email-janusz.dziedzic@tieto.com>

Fix seg0 calculation for HT40+/HT40-.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 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 7ee829a..feba1a9 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -176,6 +176,7 @@ static int dfs_find_channel(struct hostapd_iface *iface,
 
 static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface,
 				       struct hostapd_channel_data *chan,
+				       int secondary_channel,
 				       u8 *vht_oper_centr_freq_seg0_idx,
 				       u8 *vht_oper_centr_freq_seg1_idx)
 {
@@ -189,9 +190,9 @@ static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface,
 
 	switch (iface->conf->vht_oper_chwidth) {
 	case VHT_CHANWIDTH_USE_HT:
-		if (iface->conf->secondary_channel == 1)
+		if (secondary_channel == 1)
 			*vht_oper_centr_freq_seg0_idx = chan->chan + 2;
-		else if (iface->conf->secondary_channel == -1)
+		else if (secondary_channel == -1)
 			*vht_oper_centr_freq_seg0_idx = chan->chan - 2;
 		else
 			*vht_oper_centr_freq_seg0_idx = chan->chan;
@@ -366,6 +367,7 @@ dfs_get_valid_channel(struct hostapd_iface *iface,
 		*secondary_channel = 0;
 
 	dfs_adjust_vht_center_freq(iface, chan,
+				   *secondary_channel,
 				   vht_oper_centr_freq_seg0_idx,
 				   vht_oper_centr_freq_seg1_idx);
 
-- 
1.7.9.5



From j  Wed Jan  8 05:56:36 2014
From: j (Jouni Malinen)
Date: Wed, 8 Jan 2014 15:56:36 +0200
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
Message-ID: <20140108135636.GA9784@w1.fi>

On Wed, Jan 08, 2014 at 10:43:16AM +0100, Oussama Stiti wrote:
> I have added to my hostapd.conf : " vendor_elements=506f9a" and my hostapd
> deamon doesn't work anymore, it displays me:
> >Failed to set beacon parameters
> >handle_probe_req: send: Resource temporarily unavailable
> 
> Is it the right way to add the WiFi Alliance Vendor Specific attributes?

No, that is not the way to enable Hotspot 2.0 advertisement. That is
donewith hs20=1 as shown in the Hotspot 2.0 section in the example
hostapd.conf file.

-- 
Jouni Malinen                                            PGP id EFC895FA


From oussama.stiti  Wed Jan  8 06:07:41 2014
From: oussama.stiti (Oussama Stiti)
Date: Wed, 8 Jan 2014 15:07:41 +0100
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <20140108135636.GA9784@w1.fi>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
Message-ID: <CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>

I have already enabled Hotspot2.0 with hs20=1 and all parameters for
802.11u, but it's not detected as a Passpoint certified Wi-Fi by my Samsung
S4. I don't understand what's the problem.


2014/1/8 Jouni Malinen <j at w1.fi>

> On Wed, Jan 08, 2014 at 10:43:16AM +0100, Oussama Stiti wrote:
> > I have added to my hostapd.conf : " vendor_elements=506f9a" and my
> hostapd
> > deamon doesn't work anymore, it displays me:
> > >Failed to set beacon parameters
> > >handle_probe_req: send: Resource temporarily unavailable
> >
> > Is it the right way to add the WiFi Alliance Vendor Specific attributes?
>
> No, that is not the way to enable Hotspot 2.0 advertisement. That is
> donewith hs20=1 as shown in the Hotspot 2.0 section in the example
> hostapd.conf file.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
>



-- 
*Oussama Stiti*

PhD Candidate in Computer Science, LIP6, Universit? Pierre et Marie Curie.
Paris.
Telecommunications R&D engineer at VirtuOR (www.virtuor.fr)

UPMC - LIP6
Couloir 25-26, ?tage 3, Bureau 316
4 place Jussieu
75252 PARIS CEDEX 05
Tel: 01 44 27 87 86

email: oussama.stiti at gmail.com
skype: stiti.oussama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140108/7e57aa7b/attachment-0001.htm>


From j  Wed Jan  8 06:18:43 2014
From: j (Jouni Malinen)
Date: Wed, 8 Jan 2014 16:18:43 +0200
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
	<CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
Message-ID: <20140108141843.GA11104@w1.fi>

On Wed, Jan 08, 2014 at 03:07:41PM +0100, Oussama Stiti wrote:
> I have already enabled Hotspot2.0 with hs20=1 and all parameters for
> 802.11u, but it's not detected as a Passpoint certified Wi-Fi by my Samsung
> S4. I don't understand what's the problem.

Would you be able to capture Beacon and Probe Response frames from that
AP and any possible GAS/ANQP frames for that matter from time when you
try to find the AP on Samsung S4? I don't have this device and as such,
cannot test this myself.

-- 
Jouni Malinen                                            PGP id EFC895FA


From greearb  Wed Jan  8 08:46:01 2014
From: greearb (Ben Greear)
Date: Wed, 08 Jan 2014 08:46:01 -0800
Subject: [PATCH] eap-sim: Improve derived-key error message.
In-Reply-To: <CAFk-A4kSPjxFXoVbTT9vQ1nE-zNXgn2c+JPwp46V-om1DiEjjg@mail.gmail.com>
References: <1388701922-5785-1-git-send-email-greearb@candelatech.com>
	<20140107133909.GB6248@w1.fi> <52CC41C9.2030409@candelatech.com>
	<CAFk-A4kSPjxFXoVbTT9vQ1nE-zNXgn2c+JPwp46V-om1DiEjjg@mail.gmail.com>
Message-ID: <52CD80C9.3000904@candelatech.com>

On 01/07/2014 11:01 PM, Masashi Honma wrote:
> 2014/1/8 Ben Greear <greearb at candelatech.com>:
>> A build-time failure would be better, but I haven't had time to work
>> on that yet.
> 
> I made an attached patch for this.
> 
> [PATCH] EAP-SIM: Prevent build for invalid TLS implementation
> 
> Currently EAP-SIM could not be used with GnuTLS, Microsoft CryptoAPI and NSS.
> So prevent build by #error.

I'm not sure that is the proper way to do this.  I was thinking that in
the USIM code we would need to check for the crypto type and then
add an #error in the USIM code if using wrong crypto type.

Possibly other places in the code that might call that fips186_2_prf
can handle the failure more gracefully, but I did not check.

Thanks,
Ben

> 
> Signed-hostap: Masashi Honma <masashi.honma at gmail.com>
> 
> Regards,
> Masashi Honma.
> 
> 2014/1/8 Ben Greear <greearb at candelatech.com>:
>> On 01/07/2014 05:39 AM, Jouni Malinen wrote:
>>> On Thu, Jan 02, 2014 at 02:32:02PM -0800, greearb at candelatech.com wrote:
>>>> This error is caused by a crypto library that does not have
>>>> proper support for the requested feature, so warn loudly
>>>> about it.
>>>
>>> That is not the only reason for this failure and anyway, all the
>>> eap_sim_prf() callers are already using MSG_ERROR level message
>>> displaying the failure.
>>
>> I replaced two identical messages with a single message
>> with some extra information about why the error might
>> happen.  It took quite a while for me to find that one
>> small line of text and figure out it was indicating the problem,
>> and more searching around in the code before I could figure out why.
>>
>> At least for the encryption libraries I looked at, that
>> method cannot fail except when it is not implemented at
>> all.
>>
>>>> diff --git a/src/eap_common/eap_sim_common.c b/src/eap_common/eap_sim_common.c
>>>>  static int eap_sim_prf(const u8 *key, u8 *x, size_t xlen)
>>>>  {
>>>> -    return fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
>>>> +    int rv = fips186_2_prf(key, EAP_SIM_MK_LEN, x, xlen);
>>>> +    if (rv < 0) {
>>>> +            wpa_printf(MSG_ERROR, "EAP-SIM: Failed to derive keys: %i,"
>>>> +                       " Compiled with INVALID CRYPTO LIBRARY?", rv);
>>>
>>> I don't think this would that helpful way of addressing this. Better
>>> fixes would be to add support for it in GnuTLS case or prevent that
>>> build.
>>
>> A build-time failure would be better, but I haven't had time to work
>> on that yet.
>>
>> Thanks,
>> Ben
>>
>> --
>> Ben Greear <greearb at candelatech.com>
>> Candela Technologies Inc  http://www.candelatech.com
>>
>> _______________________________________________
>> HostAP mailing list
>> HostAP at lists.shmoo.com
>> http://lists.shmoo.com/mailman/listinfo/hostap


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



From kurt.bodiker  Wed Jan  8 10:06:00 2014
From: kurt.bodiker (Kurt Bodiker)
Date: Wed, 8 Jan 2014 13:06:00 -0500
Subject: problems with reassociation decisions / scan results table
Message-ID: <CAOzu-jhdyzS-x-52yHur28Z9GVh3Zf9Veg5T5S9zrM9vb8LC7g@mail.gmail.com>

All of our APs are configured with the same, hidden SSID. A probe
response from the current AP is never updated on subsequent scans once
a connection with the AP is made. This leads to the case where a
reassociation with an AP that has better signal strength is not made
because the comparison between current_bss->level and
selected_bss->level in events.c is made against old data.

I'm not sure the best place to fix this. What I did was modify the
bgscan_simple_notify_scan() method in bgscan_simple.c by bringing in
the wpa_signal_info structure, which contains the current power
levels, and overwriting the value containined in
wpa_s->current_bss->level. Here is what I added:
    187 // adding this to manipulate current_bss->level
    188         struct wpa_signal_info si;
    189         int ret;
    190         ret = wpa_drv_signal_poll(wpa_s, &si);
    191         if (ret)
    192                 return -1;      //rethink value we are
returning if we keep si
    193
    194         wpa_s->current_bss->level = si.current_signal;
    195 // done

I know this only works if the supplicant is using bgscan:simple, but
it keeps the scan_results table updated whenever a scan is done and
reassociation decisions are made on updated data. I know there has to
be a more upstream place to make the change, I just can't find it.

I am currently running a compiled wpa_supplicant from the git
repository, 0fab9ce, but I have seen this behavior in previous
versions, so nothing new.

Kurt


From holgerschurig  Wed Jan  8 10:33:22 2014
From: holgerschurig (Holger Schurig)
Date: Wed, 8 Jan 2014 19:33:22 +0100
Subject: problems with reassociation decisions / scan results table
In-Reply-To: <CAOzu-jhdyzS-x-52yHur28Z9GVh3Zf9Veg5T5S9zrM9vb8LC7g@mail.gmail.com>
References: <CAOzu-jhdyzS-x-52yHur28Z9GVh3Zf9Veg5T5S9zrM9vb8LC7g@mail.gmail.com>
Message-ID: <CAOpc7mGOA8hHpZ9pb3kMVF4N5Hv9PBX-wLf=Ywm9ke8-P6SEdw@mail.gmail.com>

> All of our APs are configured with the same, hidden SSID.

I wish this feature wouldn't have been invented in the first place. Do
you know that this buys you *NO* security at all?  The SSID is
transferred in the clear anyways, no matter the beacon contains it or
not.

Just run Kismet while in the proximity of a WIFI network with hidden
SSIDs. As soon as a client associates you'll see the SSID on your
Kismet-running laptop.


From kurt.bodiker  Wed Jan  8 10:36:37 2014
From: kurt.bodiker (Kurt Bodiker)
Date: Wed, 8 Jan 2014 13:36:37 -0500
Subject: problems with reassociation decisions / scan results table
In-Reply-To: <CAOpc7mGOA8hHpZ9pb3kMVF4N5Hv9PBX-wLf=Ywm9ke8-P6SEdw@mail.gmail.com>
References: <CAOzu-jhdyzS-x-52yHur28Z9GVh3Zf9Veg5T5S9zrM9vb8LC7g@mail.gmail.com>
	<CAOpc7mGOA8hHpZ9pb3kMVF4N5Hv9PBX-wLf=Ywm9ke8-P6SEdw@mail.gmail.com>
Message-ID: <CAOzu-jhuDDNHO=Zmy0Hw5ycabDVj0wjNfJvUhR48xPknV32yCg@mail.gmail.com>

We are full aware that this buys no security. However, the policy
makers made the decision and are completely unwilling to reverse that
decision, so I have to work with what I can.

Kurt

On Wed, Jan 8, 2014 at 1:33 PM, Holger Schurig <holgerschurig at gmail.com> wrote:
>> All of our APs are configured with the same, hidden SSID.
>
> I wish this feature wouldn't have been invented in the first place. Do
> you know that this buys you *NO* security at all?  The SSID is
> transferred in the clear anyways, no matter the beacon contains it or
> not.
>
> Just run Kismet while in the proximity of a WIFI network with hidden
> SSIDs. As soon as a client associates you'll see the SSID on your
> Kismet-running laptop.


From kurt.bodiker  Thu Jan  9 08:47:01 2014
From: kurt.bodiker (Kurt Bodiker)
Date: Thu, 9 Jan 2014 11:47:01 -0500
Subject: problems with reassociation decisions / scan results table
In-Reply-To: <CAOpc7mGOA8hHpZ9pb3kMVF4N5Hv9PBX-wLf=Ywm9ke8-P6SEdw@mail.gmail.com>
References: <CAOzu-jhdyzS-x-52yHur28Z9GVh3Zf9Veg5T5S9zrM9vb8LC7g@mail.gmail.com>
	<CAOpc7mGOA8hHpZ9pb3kMVF4N5Hv9PBX-wLf=Ywm9ke8-P6SEdw@mail.gmail.com>
Message-ID: <CAOzu-jgEJ8RMSmXsgz4U_3CWGkPgf_OBRZpGudRPKy1ySXsrSw@mail.gmail.com>

How/where in the source code does the entry for the current_bss get
updated for an SSID that is not hidden?

On Wed, Jan 8, 2014 at 1:33 PM, Holger Schurig <holgerschurig at gmail.com> wrote:
>> All of our APs are configured with the same, hidden SSID.
>
> I wish this feature wouldn't have been invented in the first place. Do
> you know that this buys you *NO* security at all?  The SSID is
> transferred in the clear anyways, no matter the beacon contains it or
> not.
>
> Just run Kismet while in the proximity of a WIFI network with hidden
> SSIDs. As soon as a client associates you'll see the SSID on your
> Kismet-running laptop.


From dimitrysh  Thu Jan  9 15:19:36 2014
From: dimitrysh (Dmitry Shmidt)
Date: Thu, 9 Jan 2014 15:19:36 -0800
Subject: [PATCH] Android: Remove hostapd dump_file functionality
Message-ID: <20140109232225.376BD13FAAF@ushik.mtv.corp.google.com>

Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 hostapd/Android.mk | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hostapd/Android.mk b/hostapd/Android.mk
index 54ac497..6e37beb 100644
--- a/hostapd/Android.mk
+++ b/hostapd/Android.mk
@@ -141,7 +141,6 @@ ifndef CONFIG_NO_DUMP_STATE
 # through control interface commands (undefine it, if you want to save in
 # binary size)
 L_CFLAGS += -DHOSTAPD_DUMP_STATE
-OBJS += dump_state.c
 OBJS += src/eapol_auth/eapol_auth_dump.c
 endif
 
-- 
1.8.5.1



From johannes  Fri Jan 10 05:19:50 2014
From: johannes (Johannes Berg)
Date: Fri, 10 Jan 2014 14:19:50 +0100
Subject: [PATCH] hwsim tests: add a hwsim controller module
Message-ID: <1389359990-30750-1-git-send-email-johannes@sipsolutions.net>

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

The controller module allows adding/destroying radios on the fly
with the recent hwsim changes.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/hwsim.py   |  53 +++++++++++
 tests/hwsim/netlink.py | 234 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 287 insertions(+)
 create mode 100644 tests/hwsim/hwsim.py
 create mode 100644 tests/hwsim/netlink.py

diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py
new file mode 100644
index 0000000..55fa0c1
--- /dev/null
+++ b/tests/hwsim/hwsim.py
@@ -0,0 +1,53 @@
+#
+# HWSIM generic netlink controller code
+# Copyright (c) 2014	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 netlink
+
+# constants
+HWSIM_CMD_CREATE_RADIO		= 4
+HWSIM_CMD_DESTROY_RADIO		= 5
+
+HWSIM_ATTR_CHANNELS		= 9
+HWSIM_ATTR_RADIO_ID		= 10
+
+# the controller class
+class HWSimController(object):
+    def __init__(self):
+        self._conn = netlink.Connection(netlink.NETLINK_GENERIC)
+        self._fid = netlink.genl_controller.get_family_id('MAC80211_HWSIM')
+
+    def create_radio(self, n_channels=None):
+        attrs = []
+        if n_channels:
+            attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels))
+        msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO,
+                                  flags = netlink.NLM_F_REQUEST |
+                                          netlink.NLM_F_ACK,
+                                  attrs = attrs)
+        return msg.send_and_recv(self._conn).ret
+
+    def destroy_radio(self, radio_id):
+        attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, radio_id)]
+        msg = netlink.GenlMessage(self._fid, HWSIM_CMD_DESTROY_RADIO,
+                                  flags = netlink.NLM_F_REQUEST |
+                                          netlink.NLM_F_ACK,
+                                  attrs = attrs)
+        msg.send_and_recv(self._conn)
+
+if __name__ == '__main__':
+    import sys
+    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]))
diff --git a/tests/hwsim/netlink.py b/tests/hwsim/netlink.py
new file mode 100644
index 0000000..835c709
--- /dev/null
+++ b/tests/hwsim/netlink.py
@@ -0,0 +1,234 @@
+#
+# (Generic) Netlink message generation/parsing
+# Copyright (c) 2007	Johannes Berg <johannes at sipsolutions.net>
+# Copyright (c) 2014	Intel Corporation
+#
+# This software may be distributed under the terms of the BSD license.
+# See README for more details.
+
+import struct, socket
+
+# flags
+NLM_F_REQUEST = 1
+NLM_F_MULTI = 2
+NLM_F_ACK = 4
+NLM_F_ECHO = 8
+
+# types
+NLMSG_NOOP	= 1
+NLMSG_ERROR	= 2
+NLMSG_DONE	= 3
+NLMSG_OVERRUN	= 4
+NLMSG_MIN_TYPE	= 0x10
+
+class Attr(object):
+    def __init__(self, attr_type, data, *values):
+        self._type = attr_type
+        if len(values):
+            self._data = struct.pack(data, *values)
+        else:
+            self._data = data
+
+    def _dump(self):
+        hdr = struct.pack("HH", len(self._data) + 4, self._type)
+        length = len(self._data)
+        pad = ((length + 4 - 1) & ~3 ) - length
+        return hdr + self._data + '\0' * pad
+
+    def __repr__(self):
+        return '<Attr type %d, data "%s">' % (self._type, repr(self._data))
+
+    def u16(self):
+        return struct.unpack('H', self._data)[0]
+    def s16(self):
+        return struct.unpack('h', self._data)[0]
+    def u32(self):
+        return struct.unpack('I', self._data)[0]
+    def s32(self):
+        return struct.unpack('i', self._data)[0]
+    def str(self):
+        return self._data
+    def nulstr(self):
+        return self._data.split('\0')[0]
+    def nested(self):
+        return parse_attributes(self._data)
+
+class StrAttr(Attr):
+    def __init__(self, attr_type, data):
+        Attr.__init__(self, attr_type, "%ds" % len(data), data)
+
+class NulStrAttr(Attr):
+    def __init__(self, attr_type, data):
+        Attr.__init__(self, attr_type, "%dsB" % len(data), data, 0)
+
+class U32Attr(Attr):
+    def __init__(self, attr_type, val):
+        Attr.__init__(self, attr_type, "I", val)
+
+class U8Attr(Attr):
+    def __init__(self, attr_type, val):
+        Attr.__init__(self, attr_type, "B", val)
+
+class Nested(Attr):
+    def __init__(self, attr_type, attrs):
+        self.attrs = attrs
+        self.type = attr_type
+
+    def _dump(self):
+        contents = []
+        for attr in self.attrs:
+            contents.append(attr._dump())
+        contents = ''.join(contents)
+        length = len(contents)
+        hdr = struct.pack("HH", length+4, self.type)
+        return hdr + contents
+
+NETLINK_ROUTE		= 0
+NETLINK_UNUSED		= 1
+NETLINK_USERSOCK	= 2
+NETLINK_FIREWALL	= 3
+NETLINK_INET_DIAG	= 4
+NETLINK_NFLOG		= 5
+NETLINK_XFRM		= 6
+NETLINK_SELINUX		= 7
+NETLINK_ISCSI		= 8
+NETLINK_AUDIT		= 9
+NETLINK_FIB_LOOKUP	= 10
+NETLINK_CONNECTOR	= 11
+NETLINK_NETFILTER	= 12
+NETLINK_IP6_FW		= 13
+NETLINK_DNRTMSG		= 14
+NETLINK_KOBJECT_UEVENT	= 15
+NETLINK_GENERIC 	= 16
+
+class Message(object):
+    def __init__(self, msg_type, flags=0, seq=-1, payload=None):
+        self.type = msg_type
+        self.flags = flags
+        self.seq = seq
+        self.pid = -1
+        payload = payload or []
+        if isinstance(payload, list):
+            contents = []
+            for attr in payload:
+                contents.append(attr._dump())
+            self.payload = ''.join(contents)
+        else:
+            self.payload = payload
+
+    def send(self, conn):
+        if self.seq == -1:
+            self.seq = conn.seq()
+
+        self.pid = conn.pid
+        length = len(self.payload)
+
+        hdr = struct.pack("IHHII", length + 4*4, self.type,
+                          self.flags, self.seq, self.pid)
+        conn.send(hdr + self.payload)
+
+    def __repr__(self):
+        return '<netlink.Message type=%d, pid=%d, seq=%d, flags=0x%x "%s">' % (
+            self.type, self.pid, self.seq, self.flags, repr(self.payload))
+
+    @property
+    def ret(self):
+        assert self.type == NLMSG_ERROR
+        return struct.unpack("i", self.payload[:4])[0]
+
+    def send_and_recv(self, conn):
+        self.send(conn)
+        while True:
+            m = conn.recv()
+            if m.seq == self.seq:
+                return m
+
+class Connection(object):
+    def __init__(self, nltype, groups=0, unexpected_msg_handler=None):
+        self.descriptor = socket.socket(socket.AF_NETLINK,
+                                        socket.SOCK_RAW, nltype)
+        self.descriptor.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 65536)
+        self.descriptor.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 65536)
+        self.descriptor.bind((0, groups))
+        self.pid, self.groups = self.descriptor.getsockname()
+        self._seq = 0
+        self.unexpected = unexpected_msg_handler
+    def send(self, msg):
+        self.descriptor.send(msg)
+    def recv(self):
+        contents = self.descriptor.recv(16384)
+        # XXX: python doesn't give us message flags, check
+        #      len(contents) vs. msglen for TRUNC
+        msglen, msg_type, flags, seq, pid = struct.unpack("IHHII", 
+                                                          contents[:16])
+        msg = Message(msg_type, flags, seq, contents[16:])
+        msg.pid = pid
+        if msg.type == NLMSG_ERROR:
+            import os
+            errno = msg.ret
+            if errno < 0:
+                err = OSError("Netlink error: %s (%d)" % (
+                    os.strerror(-errno), -errno))
+                err.errno = -errno
+                raise err
+        return msg
+    def seq(self):
+        self._seq += 1
+        return self._seq
+
+def parse_attributes(data):
+    attrs = {}
+    while len(data):
+        attr_len, attr_type = struct.unpack("HH", data[:4])
+        attrs[attr_type] = Attr(attr_type, data[4:attr_len])
+        attr_len = ((attr_len + 4 - 1) & ~3 )
+        data = data[attr_len:]
+    return attrs
+
+
+
+CTRL_CMD_UNSPEC		= 0
+CTRL_CMD_NEWFAMILY	= 1
+CTRL_CMD_DELFAMILY	= 2
+CTRL_CMD_GETFAMILY	= 3
+CTRL_CMD_NEWOPS		= 4
+CTRL_CMD_DELOPS		= 5
+CTRL_CMD_GETOPS		= 6
+
+CTRL_ATTR_UNSPEC	= 0
+CTRL_ATTR_FAMILY_ID	= 1
+CTRL_ATTR_FAMILY_NAME	= 2
+CTRL_ATTR_VERSION	= 3
+CTRL_ATTR_HDRSIZE	= 4
+CTRL_ATTR_MAXATTR	= 5
+CTRL_ATTR_OPS		= 6
+
+class GenlHdr(object):
+    def __init__(self, cmd, version = 0):
+        self.cmd = cmd
+        self.version = version
+    def _dump(self):
+        return struct.pack("BBxx", self.cmd, self.version)
+
+def _genl_hdr_parse(data):
+    return GenlHdr(*struct.unpack("BBxx", data))
+
+GENL_ID_CTRL		= NLMSG_MIN_TYPE
+
+class GenlMessage(Message):
+    def __init__(self, family, cmd, attrs=[], flags=0):
+        Message.__init__(self, family, flags=flags, payload=[GenlHdr(cmd)] + attrs)
+
+class GenlController(object):
+    def __init__(self, conn):
+        self.conn = conn
+    def get_family_id(self, family):
+        a = NulStrAttr(CTRL_ATTR_FAMILY_NAME, family)
+        m = GenlMessage(GENL_ID_CTRL, CTRL_CMD_GETFAMILY, flags=NLM_F_REQUEST, attrs=[a])
+        m.send(self.conn)
+        m = self.conn.recv()
+        gh = _genl_hdr_parse(m.payload[:4])
+        attrs = parse_attributes(m.payload[4:])
+        return attrs[CTRL_ATTR_FAMILY_ID].u16()
+
+genl_controller = GenlController(Connection(NETLINK_GENERIC))
-- 
1.8.5.1



From luca  Fri Jan 10 06:26:33 2014
From: luca (Luca Coelho)
Date: Fri, 10 Jan 2014 16:26:33 +0200
Subject: [PATCH v2] hwsim tests: Add test cases for AP channel switch
	announcement
In-Reply-To: <20131215055543.GA32676@w1.fi>
References: <1387050197-3183-1-git-send-email-luca@coelho.fi>
	<20131215055543.GA32676@w1.fi>
Message-ID: <1389363993.4519.10.camel@porter.coelho.fi>

Hi Jouni,

Sorry for the late reply.  I've been on vacations and just got back to
action now. ;)

On Sat, 2013-12-14 at 21:55 -0800, Jouni Malinen wrote:
> All of these test cases fail with older versions of
> mac80211/cfg80211/hwsim (e.g., with the version I'm running on my build
> server). As such, I cannot apply this yet.

I see.  So we should keep all the tests backward-compatible? Seems like
a lot of extra work, but makes sense since the kernel version you're
using to run the tests is independent of the hostap version...


> Would there be any way for hostapd to detect whether CSA functionality
> is properly supported (I sure hope so..) and then make these test case
> report SKIP rather than FAIL?

It can be done, but AFAICT there's currently no way to get this
information via the control interface.  To do this, I we have to export
the capa.flags information via the control API.

--
Luca.



From Arnon.Meydav  Sun Jan 12 01:54:19 2014
From: Arnon.Meydav (Arnon.Meydav at lantiq.com)
Date: Sun, 12 Jan 2014 09:54:19 +0000
Subject: Hotspot 2.0 Release 2 support in Hostapd
Message-ID: <10D0CC65D322B8498995F168AE8D89DAFCAD53E8@MUCSE039.lantiq.com>

Hi,
Does hostapd support Hotspot 2.0 Release 2 (draft) yet?
Are there any known plans when this support will be added?

Thanks,
Arnon

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


From svein.olav  Sun Jan 12 07:37:36 2014
From: svein.olav (Svein Olav Bjerkeset)
Date: Sun, 12 Jan 2014 16:37:36 +0100
Subject: hostapd + freeradius: unknown ca error
Message-ID: <007b01cf0fac$386553f0$a92ffbd0$@bjerkeset.com>

Hi,

 

I am trying to set up hostapd with freeradius to be able to authenticate
wifi-users against a kerberos-repository. The radius/kerberos integration
seems to work since radtest succeeds using a kerberos-user.

 

However when hostapd contacts the radius server, it uses EAP-TLS, and after
some traffic back and forth, hostapd sends a fatal error back to the radius
server stating that the CA is unknown. I have tried to use the ca_cert
option in hostapd.conf and point it to the radius CA, but it did not resolve
the problem. I suspect this option is only used for the internal EAP server
of hostapd (which I do not use).

 

An strace of open and stat system calls for the hostpad process seems to
show that it does not try to open any file which are SSL-releated.

 

How can I tell hostapd which CAs to trust when using an external radius
server?

 

Best reagrds,

Svein Olav Bjerkeset

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


From j  Sun Jan 12 07:41:12 2014
From: j (Jouni Malinen)
Date: Sun, 12 Jan 2014 17:41:12 +0200
Subject: hostapd + freeradius: unknown ca error
In-Reply-To: <007b01cf0fac$386553f0$a92ffbd0$@bjerkeset.com>
References: <007b01cf0fac$386553f0$a92ffbd0$@bjerkeset.com>
Message-ID: <20140112154112.GA12852@w1.fi>

On Sun, Jan 12, 2014 at 04:37:36PM +0100, Svein Olav Bjerkeset wrote:

> However when hostapd contacts the radius server, it uses EAP-TLS, and after
> some traffic back and forth, hostapd sends a fatal error back to the radius
> server stating that the CA is unknown.

That's not originating from hostapd/Authenticator. It is from the
station/supplicant that runs the EAP peer. hostapd is just proxying the
messages between the authentication server and the station in this type
of setup.

> An strace of open and stat system calls for the hostpad process seems to
> show that it does not try to open any file which are SSL-releated.

Which is expected since those operations happen at the stations.

> How can I tell hostapd which CAs to trust when using an external radius
> server?

You don't; you tell the EAP peer on the station that.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Sun Jan 12 07:42:17 2014
From: j (Jouni Malinen)
Date: Sun, 12 Jan 2014 17:42:17 +0200
Subject: Hotspot 2.0 Release 2 support in Hostapd
In-Reply-To: <10D0CC65D322B8498995F168AE8D89DAFCAD53E8@MUCSE039.lantiq.com>
References: <10D0CC65D322B8498995F168AE8D89DAFCAD53E8@MUCSE039.lantiq.com>
Message-ID: <20140112154217.GB12852@w1.fi>

On Sun, Jan 12, 2014 at 09:54:19AM +0000, Arnon.Meydav at lantiq.com wrote:
> Does hostapd support Hotspot 2.0 Release 2 (draft) yet?

As long as there is no publicly available specification, there is no
hostapd support in the public repository either.

-- 
Jouni Malinen                                            PGP id EFC895FA


From oussama.stiti  Mon Jan 13 02:38:12 2014
From: oussama.stiti (Oussama Stiti)
Date: Mon, 13 Jan 2014 11:38:12 +0100
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <20140108141843.GA11104@w1.fi>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
	<CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
	<20140108141843.GA11104@w1.fi>
Message-ID: <CABgjWUichrfz+z=Bc3DqF78vTnskp6fU21MrCO41KeLAA9YAkA@mail.gmail.com>

After analyzing my hostapd output i found something suspicious:
 nl80211: could not add multicast membership for vendor events: -2 (No such
file or directory)
Is it normal ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140113/6812ce44/attachment.htm>


From j  Mon Jan 13 06:22:56 2014
From: j (Jouni Malinen)
Date: Mon, 13 Jan 2014 16:22:56 +0200
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <CABgjWUichrfz+z=Bc3DqF78vTnskp6fU21MrCO41KeLAA9YAkA@mail.gmail.com>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
	<CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
	<20140108141843.GA11104@w1.fi>
	<CABgjWUichrfz+z=Bc3DqF78vTnskp6fU21MrCO41KeLAA9YAkA@mail.gmail.com>
Message-ID: <20140113142256.GA8908@w1.fi>

On Mon, Jan 13, 2014 at 11:38:12AM +0100, Oussama Stiti wrote:
> After analyzing my hostapd output i found something suspicious:
>  nl80211: could not add multicast membership for vendor events: -2 (No such
> file or directory)
> Is it normal ?

Yes, that functionality is a very recent kernel addition. That message
can be ignored since no current functionality depends on vendor events.

-- 
Jouni Malinen                                            PGP id EFC895FA


From oussama.stiti  Mon Jan 13 07:57:04 2014
From: oussama.stiti (Oussama Stiti)
Date: Mon, 13 Jan 2014 16:57:04 +0100
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <20140113142256.GA8908@w1.fi>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
	<CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
	<20140108141843.GA11104@w1.fi>
	<CABgjWUichrfz+z=Bc3DqF78vTnskp6fU21MrCO41KeLAA9YAkA@mail.gmail.com>
	<20140113142256.GA8908@w1.fi>
Message-ID: <CABgjWUjdmmz5UCrE-ttyt22p0Q62FjBiVg15mR5YULhLq2L9Gg@mail.gmail.com>

I was thinking about something. Should i have a certified Passpoint Wi-Fi
card for having my wireless network visible as a certified Passpoint Wi-Fi
even if my Hotspot2.0 configuration is ok ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140113/9fc84557/attachment.htm>


From johannes  Tue Jan 14 01:38:33 2014
From: johannes (Johannes Berg)
Date: Tue, 14 Jan 2014 10:38:33 +0100
Subject: [PATCH] hwsim tests: vm: read a config file from $HOME
Message-ID: <1389692313-16051-1-git-send-email-johannes@sipsolutions.net>

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

The vm-config in the subdirectory is less useful as it
will get removed by "git clean" and similar, so read a
config file from ~/.wpas-vm-config in addition.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/vm/vm-run.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh
index dc643cb..616073f 100755
--- a/tests/hwsim/vm/vm-run.sh
+++ b/tests/hwsim/vm/vm-run.sh
@@ -29,6 +29,7 @@ KVMOUT=ttyS1
 CHANNELS=1
 
 test -f vm-config && . vm-config
+test -f ~/.wpas-vm-config && . ~/.wpas-vm-config
 
 if [ -z "$KERNEL" ] && [ -z "$KERNELDIR" ] ; then
 	echo "You need to set a KERNEL or KERNELDIR (in the environment or vm-config)"
-- 
1.8.5.1



From j  Tue Jan 14 06:43:46 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 16:43:46 +0200
Subject: [PATCH 4/8] P2P: wait on GO negotiation confirm
In-Reply-To: <1387447410-8101-4-git-send-email-arik@wizery.com>
References: <1387447410-8101-1-git-send-email-arik@wizery.com>
	<1387447410-8101-4-git-send-email-arik@wizery.com>
Message-ID: <20140114144346.GA8866@w1.fi>

On Thu, Dec 19, 2013 at 12:03:26PM +0200, Arik Nemtsov wrote:
> This commit reverts:
> 792c887 P2P: Send GO Negotiation Confirm without wait
> 
> Some drivers rely on the wait period for sending packets on the
> off-channel. If the wait value is small there's a race condition where
> the driver ROC might complete before the packet was sent out.
> 
> This doesn't impede other drivers, as the wait is cancelled when a
> Tx-completion arrives from the remote peer.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan 14 07:05:37 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 17:05:37 +0200
Subject: [PATCH v2] hwsim tests: Add test cases for AP channel switch
	announcement
In-Reply-To: <1389363993.4519.10.camel@porter.coelho.fi>
References: <1387050197-3183-1-git-send-email-luca@coelho.fi>
	<20131215055543.GA32676@w1.fi>
	<1389363993.4519.10.camel@porter.coelho.fi>
Message-ID: <20140114150537.GB8866@w1.fi>

On Fri, Jan 10, 2014 at 04:26:33PM +0200, Luca Coelho wrote:
> On Sat, 2013-12-14 at 21:55 -0800, Jouni Malinen wrote:
> > All of these test cases fail with older versions of
> > mac80211/cfg80211/hwsim (e.g., with the version I'm running on my build
> > server). As such, I cannot apply this yet.
> 
> I see.  So we should keep all the tests backward-compatible? Seems like
> a lot of extra work, but makes sense since the kernel version you're
> using to run the tests is independent of the hostap version...

Depends on what you mean with backward-compatible.. There is no need to
be backwards compatible with older wpa_supplicant/hostapd versions, but
there is need for the full setup to work with number of different kernel
versions. This does not need to include everything, but in general, it
would be nice to be able to at minimum report SKIP instead of FAIL if
the kernel does not support something. In general, I think something
went wrong with the kernel interface design or hostapd/wpa_supplicant
implementation if that cannot be done easily since
hostapd/wpa_supplicant themselves will obviously need to work with older
kernel versions and it is useful helpful to know what functionality is
available.

At minimum, there will be a hard blocker on the new test cases not
failing on my test server since I try not to commit anything that breaks
those tests. I may be convinced to update the Backports version there
when proposing a new test case, but in general, there better be a good
reason for this and why the test case could not be made to report SKIP
instead.

> > Would there be any way for hostapd to detect whether CSA functionality
> > is properly supported (I sure hope so..) and then make these test case
> > report SKIP rather than FAIL?
> 
> It can be done, but AFAICT there's currently no way to get this
> information via the control interface.  To do this, I we have to export
> the capa.flags information via the control API.

That has already been done.. However, the current wireless-testing.git
snapshot is still disabling CSA and if I re-enable it in cfg80211 and
use the latest mac80211_hwsim contribution to claim support for it, some
of these test cases fail due to kernel issues:

START ap_csa_1_switch 1/6
PASS ap_csa_1_switch 4.358744 2014-01-14 15:02:09.299603
START ap_csa_1_switch_count_0 2/6
FAIL ap_csa_1_switch_count_0 3.481473 2014-01-14 15:02:12.795904
START ap_csa_1_switch_count_1 3/6
PASS ap_csa_1_switch_count_1 3.312774 2014-01-14 15:02:16.222982
START ap_csa_2_switches 4/6
PASS ap_csa_2_switches 5.610565 2014-01-14 15:02:21.848812
START ap_csa_2_switches_count_0 5/6
FAIL ap_csa_2_switches_count_0 3.788668 2014-01-14 15:02:25.652828
START ap_csa_2_switches_count_1 6/6
PASS ap_csa_2_switches_count_1 3.759073 2014-01-14 15:02:29.531521
failed tests: ap_csa_1_switch_count_0 ap_csa_2_switches_count_0

With both failures due to this one:
WARNING: CPU: 0 PID: 0 at net/mac80211/tx.c:2443 ieee80211_update_csa+0x221/0x2a0()


There needs to be a reasonable expectation of being able to run these
tests with wireless-testing.git successfully before it is justifiable to
add the test cases into hostap.git.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From oussama.stiti  Tue Jan 14 07:36:33 2014
From: oussama.stiti (Oussama Stiti)
Date: Tue, 14 Jan 2014 16:36:33 +0100
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <CABgjWUjdmmz5UCrE-ttyt22p0Q62FjBiVg15mR5YULhLq2L9Gg@mail.gmail.com>
References: <CABgjWUhgY4MZhe6YVT66YjoAkErDb_rVhnx_8HGL0HfvyhBBvg@mail.gmail.com>
	<23FB6EFA-ADBA-4881-8FD1-DD56A0328B18@scottarmitage.eu>
	<CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
	<CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
	<20140108141843.GA11104@w1.fi>
	<CABgjWUichrfz+z=Bc3DqF78vTnskp6fU21MrCO41KeLAA9YAkA@mail.gmail.com>
	<20140113142256.GA8908@w1.fi>
	<CABgjWUjdmmz5UCrE-ttyt22p0Q62FjBiVg15mR5YULhLq2L9Gg@mail.gmail.com>
Message-ID: <CABgjWUjRFAKt-pVcCs5yA57A4YU_4kzB++737HpYAYRgtOaG1Q@mail.gmail.com>

Any idea? I found out yesterday that there is Wi-Fi chipsets ( Atheros and
Broadcom) certified Passpoint, what does it mean? Normally passpoint is a
software modification, we have nothing to do with hardware, so any Wi-Fi
card could be turned into a certified Passpoint one. Am i right ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140114/944d8dee/attachment.htm>


From j  Tue Jan 14 08:11:28 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 18:11:28 +0200
Subject: [PATCH 1/2] hostapd: DFS/CSA check if CSA in progress
In-Reply-To: <1389176868-6610-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1389176868-6610-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <20140114161128.GA22785@w1.fi>

On Wed, Jan 08, 2014 at 11:27:47AM +0100, Janusz Dziedzic wrote:
> Check if CSA is already in progress, before
> trigger new channel switch.

Thanks, applied with the v2 of 2/2.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan 14 08:12:20 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 18:12:20 +0200
Subject: [PATCH] Android: Remove hostapd dump_file functionality
In-Reply-To: <20140109232225.376BD13FAAF@ushik.mtv.corp.google.com>
References: <20140109232225.376BD13FAAF@ushik.mtv.corp.google.com>
Message-ID: <20140114161220.GB22785@w1.fi>

Thanks, applied. One of these days, I should finally get the buildbot
setup verifying proper Android build as well..

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan 14 08:12:54 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 18:12:54 +0200
Subject: [PATCH] hwsim tests: add a hwsim controller module
In-Reply-To: <1389359990-30750-1-git-send-email-johannes@sipsolutions.net>
References: <1389359990-30750-1-git-send-email-johannes@sipsolutions.net>
Message-ID: <20140114161254.GC22785@w1.fi>

On Fri, Jan 10, 2014 at 02:19:50PM +0100, Johannes Berg wrote:
> The controller module allows adding/destroying radios on the fly
> with the recent hwsim changes.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan 14 08:13:09 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 18:13:09 +0200
Subject: [PATCH] hwsim tests: vm: read a config file from $HOME
In-Reply-To: <1389692313-16051-1-git-send-email-johannes@sipsolutions.net>
References: <1389692313-16051-1-git-send-email-johannes@sipsolutions.net>
Message-ID: <20140114161309.GD22785@w1.fi>

On Tue, Jan 14, 2014 at 10:38:33AM +0100, Johannes Berg wrote:
> The vm-config in the subdirectory is less useful as it
> will get removed by "git clean" and similar, so read a
> config file from ~/.wpas-vm-config in addition.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From johannes  Tue Jan 14 08:29:49 2014
From: johannes (Johannes Berg)
Date: Tue, 14 Jan 2014 17:29:49 +0100
Subject: [PATCH] hwsim tests: vm: add optional time-warp
Message-ID: <1389716989-7441-1-git-send-email-johannes@sipsolutions.net>

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

To test the code under the influence of time jumps, add the option
(--timewarp) to the VM tests to reset the clock all the time, which
makes the wall clock time jump speed up 20x, causing gettimeofday()
to be unreliable for timeout calculations.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/vm/inside.sh | 9 +++++++++
 tests/hwsim/vm/vm-run.sh | 9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/vm/inside.sh b/tests/hwsim/vm/inside.sh
index 036197b..833253d 100755
--- a/tests/hwsim/vm/inside.sh
+++ b/tests/hwsim/vm/inside.sh
@@ -18,6 +18,7 @@ sysctl kernel.panic=1
 
 # get extra command line variables from /proc/cmdline
 TESTDIR=$(sed 's/.*testdir=\([^ ]*\) .*/\1/' /proc/cmdline)
+TIMEWARP=$(sed 's/.*timewarp=\([^ ]*\) .*/\1/' /proc/cmdline)
 EPATH=$(sed 's/.*EPATH=\([^ ]*\) .*/\1/' /proc/cmdline)
 ARGS=$(sed 's/.*ARGS=//' /proc/cmdline)
 
@@ -56,6 +57,14 @@ ip link set lo up
 mkdir /tmp/logs
 mount -t 9p -o trans=virtio,rw logshare /tmp/logs
 
+if [ "$TIMEWARP" = "1" ] ; then
+    (
+        while sleep 1 ; do
+            date --set "@$(($(date +%s) + 19))"
+        done
+    ) &
+fi
+
 # check if we're rebooting due to a kernel panic ...
 if grep -q 'Kernel panic' /tmp/logs/console ; then
 	echo "KERNEL CRASHED!" >/dev/ttyS0
diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh
index 6feaaaa..c6edb57 100755
--- a/tests/hwsim/vm/vm-run.sh
+++ b/tests/hwsim/vm/vm-run.sh
@@ -96,6 +96,13 @@ else
     CODECOV=no
 fi
 
+if [ "$1" == "--timewarp" ] ; then
+    TIMEWARP=1
+    shift
+else
+    TIMEWARP=0
+fi
+
 echo "Starting test run in a virtual machine"
 
 kvm \
@@ -106,7 +113,7 @@ kvm \
 	-fsdev local,security_model=none,id=fsdev-logs,path="$LOGDIR",writeout=immediate \
 	-device virtio-9p-pci,id=fs-logs,fsdev=fsdev-logs,mount_tag=logshare \
 	-monitor null -serial stdio -serial file:$LOGDIR/console \
-	-append "mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=6 init=$CMD testdir=$TESTDIR console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$*"
+	-append "mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=6 init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$*"
 
 if [ $CODECOV = "yes" ]; then
     mv $LOGDIR/alt-wpa_supplicant /tmp/logs
-- 
1.8.5.1



From j  Tue Jan 14 08:33:16 2014
From: j (Jouni Malinen)
Date: Tue, 14 Jan 2014 18:33:16 +0200
Subject: HotSpot2.0 with hostapd and Galaxy S4
In-Reply-To: <CABgjWUjRFAKt-pVcCs5yA57A4YU_4kzB++737HpYAYRgtOaG1Q@mail.gmail.com>
References: <CABgjWUh-zTtG8_7Y2OEMwsPEZwD3Jqug-iLxVOOUJLyHVrNrfg@mail.gmail.com>
	<9C23C56B-F99B-47AA-B2C6-E2A1EF0EB793@scottarmitage.eu>
	<CABgjWUg_jAuy_0GLoNBLn-ztwAM5=8AO-OwpeXV4G_dD=eC_hA@mail.gmail.com>
	<20140108135636.GA9784@w1.fi>
	<CABgjWUjzjEL5hhMovCVT=L+JThPjYnBLwT0WLqoaMXBsAgYjhA@mail.gmail.com>
	<20140108141843.GA11104@w1.fi>
	<CABgjWUichrfz+z=Bc3DqF78vTnskp6fU21MrCO41KeLAA9YAkA@mail.gmail.com>
	<20140113142256.GA8908@w1.fi>
	<CABgjWUjdmmz5UCrE-ttyt22p0Q62FjBiVg15mR5YULhLq2L9Gg@mail.gmail.com>
	<CABgjWUjRFAKt-pVcCs5yA57A4YU_4kzB++737HpYAYRgtOaG1Q@mail.gmail.com>
Message-ID: <20140114163316.GB23034@w1.fi>

On Tue, Jan 14, 2014 at 04:36:33PM +0100, Oussama Stiti wrote:
> Any idea? I found out yesterday that there is Wi-Fi chipsets ( Atheros and
> Broadcom) certified Passpoint, what does it mean? Normally passpoint is a
> software modification, we have nothing to do with hardware, so any Wi-Fi
> card could be turned into a certified Passpoint one. Am i right ?

Passpoint certification is for the combination of the hardware component
and software. From functionality view point, whether a device is
formally certified or not does not really change anything if the
implementation is correct. So yes, I'd recommend certified devices in
general, but no, that would be unlikely to solve whatever the issue is
that you are seeing here.

-- 
Jouni Malinen                                            PGP id EFC895FA


From luca  Tue Jan 14 23:58:52 2014
From: luca (Luca Coelho)
Date: Wed, 15 Jan 2014 09:58:52 +0200
Subject: [PATCH v2] hwsim tests: Add test cases for AP channel switch
	announcement
In-Reply-To: <20140114150537.GB8866@w1.fi>
References: <1387050197-3183-1-git-send-email-luca@coelho.fi>
	<20131215055543.GA32676@w1.fi>
	<1389363993.4519.10.camel@porter.coelho.fi>
	<20140114150537.GB8866@w1.fi>
Message-ID: <1389772732.8062.18.camel@porter.coelho.fi>

On Tue, 2014-01-14 at 17:05 +0200, Jouni Malinen wrote:
> On Fri, Jan 10, 2014 at 04:26:33PM +0200, Luca Coelho wrote:
> > On Sat, 2013-12-14 at 21:55 -0800, Jouni Malinen wrote:
> > > All of these test cases fail with older versions of
> > > mac80211/cfg80211/hwsim (e.g., with the version I'm running on my build
> > > server). As such, I cannot apply this yet.
> > 
> > I see.  So we should keep all the tests backward-compatible? Seems like
> > a lot of extra work, but makes sense since the kernel version you're
> > using to run the tests is independent of the hostap version...
> 
> Depends on what you mean with backward-compatible.. There is no need to
> be backwards compatible with older wpa_supplicant/hostapd versions, but
> there is need for the full setup to work with number of different kernel
> versions.

That's what I meant.  Backward-compatible with old kernels.


> This does not need to include everything, but in general, it
> would be nice to be able to at minimum report SKIP instead of FAIL if
> the kernel does not support something. In general, I think something
> went wrong with the kernel interface design or hostapd/wpa_supplicant
> implementation if that cannot be done easily since
> hostapd/wpa_supplicant themselves will obviously need to work with older
> kernel versions and it is useful helpful to know what functionality is
> available.

I totally agree. :)


> At minimum, there will be a hard blocker on the new test cases not
> failing on my test server since I try not to commit anything that breaks
> those tests. I may be convinced to update the Backports version there
> when proposing a new test case, but in general, there better be a good
> reason for this and why the test case could not be made to report SKIP
> instead.

Fair enough.  I tend to forget that these tests are mostly for hostap
and not the for the kernel itself.  They just do such a good job in
testing the kernel that I get carried away. :P


> > > Would there be any way for hostapd to detect whether CSA functionality
> > > is properly supported (I sure hope so..) and then make these test case
> > > report SKIP rather than FAIL?
> > 
> > It can be done, but AFAICT there's currently no way to get this
> > information via the control interface.  To do this, I we have to export
> > the capa.flags information via the control API.
> 
> That has already been done.. However, the current wireless-testing.git
> snapshot is still disabling CSA and if I re-enable it in cfg80211 and
> use the latest mac80211_hwsim contribution to claim support for it, some
> of these test cases fail due to kernel issues:
> 
> START ap_csa_1_switch 1/6
> PASS ap_csa_1_switch 4.358744 2014-01-14 15:02:09.299603
> START ap_csa_1_switch_count_0 2/6
> FAIL ap_csa_1_switch_count_0 3.481473 2014-01-14 15:02:12.795904
> START ap_csa_1_switch_count_1 3/6
> PASS ap_csa_1_switch_count_1 3.312774 2014-01-14 15:02:16.222982
> START ap_csa_2_switches 4/6
> PASS ap_csa_2_switches 5.610565 2014-01-14 15:02:21.848812
> START ap_csa_2_switches_count_0 5/6
> FAIL ap_csa_2_switches_count_0 3.788668 2014-01-14 15:02:25.652828
> START ap_csa_2_switches_count_1 6/6
> PASS ap_csa_2_switches_count_1 3.759073 2014-01-14 15:02:29.531521
> failed tests: ap_csa_1_switch_count_0 ap_csa_2_switches_count_0
> 
> With both failures due to this one:
> WARNING: CPU: 0 PID: 0 at net/mac80211/tx.c:2443 ieee80211_update_csa+0x221/0x2a0()

Right there is still some stuff missing in wireless-testing.  And, in
any case, even when all the latest submitted patches get into
wireless-testing, the tests with count 0 and count 1 will still fail
because the CSA action frame implementation for BSS is still missing.


> There needs to be a reasonable expectation of being able to run these
> tests with wireless-testing.git successfully before it is justifiable to
> add the test cases into hostap.git.
 
Right, I understand your point.

I was looking from a different perspective, a bit more like test-driven
development.  As I see, all the tests *are* valid and hostap's
implementation supports them all.  So the tests could be added to hostap
already.  If we did this, we would have a clearer visibility of the
status of CSA in the kernel.  The fact that the current kernel still
fails some tests is a bug in the kernel; not in testcases nor in hostap.

Anyway, I don't want to change your existing process.  And there's no
hurry to get these tests in the mainline, so we can wait. :)

--
Cheers,
Luca.



From arend  Wed Jan 15 01:11:32 2014
From: arend (Arend van Spriel)
Date: Wed, 15 Jan 2014 10:11:32 +0100
Subject: [PATCH 1/2] wpa_s: reset wpa_s::normal_scans upon entering DISABLED
	state
Message-ID: <1389777093-4814-1-git-send-email-arend@broadcom.com>

Depending on the implementation the scheduled scan may not give results
quickly when in DISCONNECTED state. This patch resets wpa_s::normal_scans
upon entering to the DISABLED state so a normal scan is assured upon
going to DISCONNECTED state. This mainly solves a long reconnect time
observed upon repeated kernel driver reloads, ie. third reload resulted
in a scheduled scan.

Reviewed-by: Hante Meuleman <meuleman at broadcom.com>
Signed-hostap: Arend van Spriel <arend at broadcom.com>
---
 wpa_supplicant/wpa_supplicant.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 78e2749..a2281f1 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -652,6 +652,10 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
 		wpa_supplicant_state_txt(wpa_s->wpa_state),
 		wpa_supplicant_state_txt(state));
 
+	if (state == WPA_INTERFACE_DISABLED)
+		/* assure normal scan when interface is restored */
+		wpa_s->normal_scans = 0;
+
 	if (state == WPA_COMPLETED)
 		wpas_connect_work_done(wpa_s);
 
-- 
1.7.10.4



From arend  Wed Jan 15 01:11:33 2014
From: arend (Arend van Spriel)
Date: Wed, 15 Jan 2014 10:11:33 +0100
Subject: [PATCH 2/2] wpa_s: use minimal scan delay upon EVENT_INTERFACE_ADDED
In-Reply-To: <1389777093-4814-1-git-send-email-arend@broadcom.com>
References: <1389777093-4814-1-git-send-email-arend@broadcom.com>
Message-ID: <1389777093-4814-2-git-send-email-arend@broadcom.com>

This patch resets the static interface_count to zero in case of
wpa_supplicant_driver_init() call for wpa_s which is in DISABLED
state. This interface_count is used for the delay of the scan
which is now minimal so a reconnect. This may collide with a scan
for another interface, but the same is true for any chosen delay
in this scenario. Also the state change to DISCONNECTED is moved
to wpa_supplicant_driver_init() so it will move from DISABLED to
INACTIVE when there are no enabled networks.

Tested-by: Hante Meuleman <meuleman at broadcom.com>
Signed-off-by: Arend van Spriel <arend at broadcom.com>
---
 wpa_supplicant/events.c         |    1 -
 wpa_supplicant/wpa_supplicant.c |    4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 632f0fe..2121bf0 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -2311,7 +2311,6 @@ wpa_supplicant_event_interface_status(struct wpa_supplicant *wpa_s,
 			wpa_msg(wpa_s, MSG_INFO, "Failed to initialize the "
 				"driver after interface was added");
 		}
-		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
 		break;
 	case EVENT_INTERFACE_REMOVED:
 		wpa_dbg(wpa_s, MSG_DEBUG, "Configured interface was removed");
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index a2281f1..86f8eac 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2622,6 +2622,10 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 	wpa_s->prev_scan_wildcard = 0;
 
 	if (wpa_supplicant_enabled_networks(wpa_s)) {
+		if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
+			wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+			interface_count = 0;
+		}
 		if (wpa_supplicant_delayed_sched_scan(wpa_s, interface_count,
 						      100000))
 			wpa_supplicant_req_scan(wpa_s, interface_count,
-- 
1.7.10.4



From jithu  Wed Jan 15 02:22:51 2014
From: jithu (Jithu Jance)
Date: Wed, 15 Jan 2014 15:52:51 +0530
Subject: [PATCH 1/1] P2P: Don't expire the peer, if GO-NEG is in progress
Message-ID: <20140115102251.GA9645@jithu@broadcom.com>

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

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 083a156..e5877d7 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -56,6 +56,15 @@ static void p2p_expire_peers(struct p2p_data *p2p)
 		if (dev->last_seen.sec + P2P_PEER_EXPIRATION_AGE >= now.sec)
 			continue;

+		if (p2p->go_neg_peer && (os_memcmp(p2p->go_neg_peer->info.p2p_device_addr,
+				dev->info.p2p_device_addr, ETH_ALEN) == 0)) {
+			/*
+			 * GO Negotiation is in progress with the Peer. So don't expire the
+			 * Peer till GO-Neg fails or timeout happens
+			 */
+			continue;
+		}
+
 		if (p2p->cfg->go_connected &&
 		    p2p->cfg->go_connected(p2p->cfg->cb_ctx,
 					   dev->info.p2p_device_addr)) {
--
1.7.9.5



From jithu  Wed Jan 15 05:47:19 2014
From: jithu (Jithu Jance)
Date: Wed, 15 Jan 2014 19:17:19 +0530
Subject: [PATCH 1/1] P2P: Use GO's operating channel to do a directed scan
	during the Join
Message-ID: <20140115134719.GA11310@jithu@broadcom.com>

Use P2P GO's operating channel info to do a directed scan
during the Join operation.

Signed-hostap: Jithu Jance <jithu at broadcom.com>
---
 wpa_supplicant/p2p_supplicant.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 7d5667c..8c25970 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -4239,6 +4239,16 @@ static void wpas_p2p_join_scan_req(struct wpa_supplicant *wpa_s, int freq,
 	struct wpabuf *wps_ie, *ies;
 	size_t ielen;
 	int freqs[2] = { 0, 0 };
+	int oper_freq;
+
+	if (!freq) {
+		/*
+		 * If Freq is not provided, check the operating freq of the GO and
+		 * do a directed scan
+		 */
+		freq = ((oper_freq = p2p_get_oper_freq(wpa_s->global->p2p,
+				wpa_s->pending_join_iface_addr)) == -1) ? 0 : oper_freq;
+	}

 	os_memset(&params, 0, sizeof(params));

--
1.7.9.5



From johannes  Wed Jan 15 06:06:39 2014
From: johannes (Johannes Berg)
Date: Wed, 15 Jan 2014 15:06:39 +0100
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <52CC4393.8010304@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>
Message-ID: <1389794799.4338.19.camel@jlt4.sipsolutions.net>

On Tue, 2014-01-07 at 10:12 -0800, Ben Greear wrote:

> > That code isn't really documentation though :)
> 
> This page mentions it as well, about half way down.
> 
> http://wireless.kernel.org/en/developers/Documentation/mac80211/queues

Which again is mac80211 documentation.

> As is, unless the NIC has firmware that inspects packets and
> twiddles the queue selection based on that, some management packets do not go
> out in the VO queue.
> 
> With my patch, it (ath9k) seems to work properly.

Sure, but you're ignoring that there are drivers that aren't mac80211
based, nor forced to interpret the priority this way. At least not
unless you go to the trouble of defining it as such in the kernel.

Now, I'm not necessarily saying this would be a bad thing, but as it
stands right now I'm not convinced that this can be done.

johannes



From greearb  Wed Jan 15 09:18:21 2014
From: greearb (Ben Greear)
Date: Wed, 15 Jan 2014 09:18:21 -0800
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <1389794799.4338.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>
Message-ID: <52D6C2DD.2090306@candelatech.com>

On 01/15/2014 06:06 AM, Johannes Berg wrote:
> On Tue, 2014-01-07 at 10:12 -0800, Ben Greear wrote:
> 
>>> That code isn't really documentation though :)
>>
>> This page mentions it as well, about half way down.
>>
>> http://wireless.kernel.org/en/developers/Documentation/mac80211/queues
> 
> Which again is mac80211 documentation.
> 
>> As is, unless the NIC has firmware that inspects packets and
>> twiddles the queue selection based on that, some management packets do not go
>> out in the VO queue.
>>
>> With my patch, it (ath9k) seems to work properly.
> 
> Sure, but you're ignoring that there are drivers that aren't mac80211
> based, nor forced to interpret the priority this way. At least not
> unless you go to the trouble of defining it as such in the kernel.
> 
> Now, I'm not necessarily saying this would be a bad thing, but as it
> stands right now I'm not convinced that this can be done.

I'm not trying to force a driver to do anything, but I would definitely
like to suggest a driver give the management packets high priority,
and for drivers I can use and modify, I will try to make sure they work
properly.  Other driver writers can do as they wish.

If anyone can proclaim an API, then you can.  If you have another API in mind,
please detail it.  If no one cares, then I can just carry the hostap patch in
my own tree and move on to other things.

Thanks,
Ben


> 
> johannes
> 


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



From dimitrysh  Wed Jan 15 10:27:19 2014
From: dimitrysh (Dmitry Shmidt)
Date: Wed, 15 Jan 2014 10:27:19 -0800
Subject: [PATCH 1/2] P2P: Add missing direct global ctrl_iface commands for P2P
Message-ID: <20140115183351.1625C1401FA@ushik.mtv.corp.google.com>

Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 wpa_supplicant/ctrl_iface.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 0214b38..e3c0c2c 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -6345,6 +6345,8 @@ static char * wpas_global_ctrl_iface_redir_p2p(struct wpa_global *global,
 {
 #ifdef CONFIG_P2P
 	static const char * cmd[] = {
+		"LIST_NETWORKS",
+		"SAVE_CONFIG",
 		"P2P_FIND",
 		"P2P_STOP_FIND",
 		"P2P_LISTEN",
@@ -6359,6 +6361,12 @@ static char * wpas_global_ctrl_iface_redir_p2p(struct wpa_global *global,
 		NULL
 	};
 	static const char * prefix[] = {
+#ifdef ANDROID
+		"DRIVER ",
+#endif
+		"GET_NETWORK ",
+		"REMOVE_NETWORK ",
+		"SET ",
 		"P2P_FIND ",
 		"P2P_CONNECT ",
 		"P2P_LISTEN ",
-- 
1.8.5.2



From dimitrysh  Wed Jan 15 10:30:12 2014
From: dimitrysh (Dmitry Shmidt)
Date: Wed, 15 Jan 2014 10:30:12 -0800
Subject: [PATCH 2/2] Update IE after association regardless driver roaming
	support
Message-ID: <20140115183356.283101401FA@ushik.mtv.corp.google.com>

Update IE is necessary if roaming is done by driver / FW, but will
not harm in other case

Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 wpa_supplicant/events.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 632f0fe..f936b55 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1865,8 +1865,7 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
 				wpa_s->current_bss = bss;
 		}
 
-		if (wpa_s->conf->ap_scan == 1 &&
-		    wpa_s->drv_flags & WPA_DRIVER_FLAGS_BSS_SELECTION) {
+		if (wpa_s->conf->ap_scan == 1) {
 			if (wpa_supplicant_assoc_update_ie(wpa_s) < 0)
 				wpa_msg(wpa_s, MSG_WARNING,
 					"WPA/RSN IEs not updated");
-- 
1.8.5.2



From johannes  Wed Jan 15 11:58:39 2014
From: johannes (Johannes Berg)
Date: Wed, 15 Jan 2014 20:58:39 +0100
Subject: [PATCH v2] hwsim tests: vm: add optional time-warp
Message-ID: <1389815919-19067-1-git-send-email-johannes@sipsolutions.net>

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

To test the code under the influence of time jumps, add the option
(--timewarp) to the VM tests to reset the clock all the time, which
makes the wall clock time jump speed up 20x, causing gettimeofday()
to be unreliable for timeout calculations.

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/vm/inside.sh | 9 +++++++++
 tests/hwsim/vm/vm-run.sh | 9 ++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/vm/inside.sh b/tests/hwsim/vm/inside.sh
index 036197b..833253d 100755
--- a/tests/hwsim/vm/inside.sh
+++ b/tests/hwsim/vm/inside.sh
@@ -18,6 +18,7 @@ sysctl kernel.panic=1
 
 # get extra command line variables from /proc/cmdline
 TESTDIR=$(sed 's/.*testdir=\([^ ]*\) .*/\1/' /proc/cmdline)
+TIMEWARP=$(sed 's/.*timewarp=\([^ ]*\) .*/\1/' /proc/cmdline)
 EPATH=$(sed 's/.*EPATH=\([^ ]*\) .*/\1/' /proc/cmdline)
 ARGS=$(sed 's/.*ARGS=//' /proc/cmdline)
 
@@ -56,6 +57,14 @@ ip link set lo up
 mkdir /tmp/logs
 mount -t 9p -o trans=virtio,rw logshare /tmp/logs
 
+if [ "$TIMEWARP" = "1" ] ; then
+    (
+        while sleep 1 ; do
+            date --set "@$(($(date +%s) + 19))"
+        done
+    ) &
+fi
+
 # check if we're rebooting due to a kernel panic ...
 if grep -q 'Kernel panic' /tmp/logs/console ; then
 	echo "KERNEL CRASHED!" >/dev/ttyS0
diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh
index 6feaaaa..c6edb57 100755
--- a/tests/hwsim/vm/vm-run.sh
+++ b/tests/hwsim/vm/vm-run.sh
@@ -96,6 +96,13 @@ else
     CODECOV=no
 fi
 
+if [ "$1" == "--timewarp" ] ; then
+    TIMEWARP=1
+    shift
+else
+    TIMEWARP=0
+fi
+
 echo "Starting test run in a virtual machine"
 
 kvm \
@@ -106,7 +113,7 @@ kvm \
 	-fsdev local,security_model=none,id=fsdev-logs,path="$LOGDIR",writeout=immediate \
 	-device virtio-9p-pci,id=fs-logs,fsdev=fsdev-logs,mount_tag=logshare \
 	-monitor null -serial stdio -serial file:$LOGDIR/console \
-	-append "mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=6 init=$CMD testdir=$TESTDIR console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$*"
+	-append "mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=6 init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$*"
 
 if [ $CODECOV = "yes" ]; then
     mv $LOGDIR/alt-wpa_supplicant /tmp/logs
-- 
1.8.5.1



From carlos.henriquez  Thu Jan 16 07:32:26 2014
From: carlos.henriquez (Carlos Henriquez)
Date: Thu, 16 Jan 2014 12:32:26 -0300
Subject: Association table
Message-ID: <CABQ3_qajwBJXd1cp6Udy6JsxAw5So3aGPY-ZwOsrE1ZGnEnoxw@mail.gmail.com>

Hi all :D, I read the config file but I didn't found anything about what I
want, so I'm here for help.
 Is possible to create an entry in the association table manually on an AP
using *hostapd *without the use of management frames (association
handshakes). And other question, can I force to kick a client using an
deassociation frame or by other method manually?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140116/95a52b08/attachment.htm>


From j  Fri Jan 17 01:32:49 2014
From: j (Jouni Malinen)
Date: Fri, 17 Jan 2014 11:32:49 +0200
Subject: [PATCH 2/2] Update IE after association regardless driver
	roaming support
In-Reply-To: <20140115183356.283101401FA@ushik.mtv.corp.google.com>
References: <20140115183356.283101401FA@ushik.mtv.corp.google.com>
Message-ID: <20140117093249.GB6159@w1.fi>

On Wed, Jan 15, 2014 at 10:30:12AM -0800, Dmitry Shmidt wrote:
> Update IE is necessary if roaming is done by driver / FW, but will
> not harm in other case

Could you please clarify why this would not do harm in other cases? The
WPA_DRIVER_FLAGS_BSS_SELECTION case is know to require this which is why
the IE update code is there. However, it is not known whether there
could be drivers that do not have correct information in scan results
for all cases (e.g., some of the hidden SSID/multi-SSID cases could be a
bit risky in this area). Consequently, I could see this change
potentially breaking some working cases. Since I see no real
justification for this change, I'd rather not add it.

Drivers that do BSS selection in the driver/firmware better indicate
that to the user space and the real fix here would be to make any driver
that could today need this change work properly in this area. Working
around them with a change in wpa_supplicant is not justifiable if there
is risk in breaking something for other drivers.

As far as being able to fix one known driver misbehavior in this area,
there is already a change in upstream kernel moving ahead with the
BSSID/frequency hint attributes. Once that hits wireless-testing.git, we
can add the wpa_supplicant changes to provide that information to the
driver even when WPA_DRIVER_FLAGS_BSS_SELECTION is advertised. That will
hopefully remove any assumed need for not advertising this capability
correctly.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Jan 17 02:33:52 2014
From: j (Jouni Malinen)
Date: Fri, 17 Jan 2014 12:33:52 +0200
Subject: [PATCH 1/2] wpa_s: reset wpa_s::normal_scans upon entering
	DISABLED state
In-Reply-To: <1389777093-4814-1-git-send-email-arend@broadcom.com>
References: <1389777093-4814-1-git-send-email-arend@broadcom.com>
Message-ID: <20140117103352.GA14224@w1.fi>

On Wed, Jan 15, 2014 at 10:11:32AM +0100, Arend van Spriel wrote:
> Depending on the implementation the scheduled scan may not give results
> quickly when in DISCONNECTED state. This patch resets wpa_s::normal_scans
> upon entering to the DISABLED state so a normal scan is assured upon
> going to DISCONNECTED state. This mainly solves a long reconnect time
> observed upon repeated kernel driver reloads, ie. third reload resulted
> in a scheduled scan.

Thanks, applied both patches.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Jan 17 02:34:41 2014
From: j (Jouni Malinen)
Date: Fri, 17 Jan 2014 12:34:41 +0200
Subject: [PATCH 1/1] P2P: Don't expire the peer, if GO-NEG is in progress
In-Reply-To: <20140115102251.GA9645@jithu@broadcom.com>
References: <20140115102251.GA9645@jithu@broadcom.com>
Message-ID: <20140117103441.GB14224@w1.fi>

On Wed, Jan 15, 2014 at 03:52:51PM +0530, Jithu Jance wrote:
> diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
> @@ -56,6 +56,15 @@ static void p2p_expire_peers(struct p2p_data *p2p)
> +		if (p2p->go_neg_peer && (os_memcmp(p2p->go_neg_peer->info.p2p_device_addr,
> +				dev->info.p2p_device_addr, ETH_ALEN) == 0)) {

Thanks, applied. Though, I replaced this memcpy with simpler dev ==
p2p->go_neg_peer.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Jan 17 02:35:02 2014
From: j (Jouni Malinen)
Date: Fri, 17 Jan 2014 12:35:02 +0200
Subject: [PATCH 1/1] P2P: Use GO's operating channel to do a directed
	scan during the Join
In-Reply-To: <20140115134719.GA11310@jithu@broadcom.com>
References: <20140115134719.GA11310@jithu@broadcom.com>
Message-ID: <20140117103502.GC14224@w1.fi>

On Wed, Jan 15, 2014 at 07:17:19PM +0530, Jithu Jance wrote:
> Use P2P GO's operating channel info to do a directed scan
> during the Join operation.

Thanks, applied with some cleanup.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Jan 17 02:37:07 2014
From: j (Jouni Malinen)
Date: Fri, 17 Jan 2014 12:37:07 +0200
Subject: [PATCH 1/2] P2P: Add missing direct global ctrl_iface commands
	for P2P
In-Reply-To: <20140115183351.1625C1401FA@ushik.mtv.corp.google.com>
References: <20140115183351.1625C1401FA@ushik.mtv.corp.google.com>
Message-ID: <20140117103707.GD14224@w1.fi>

On Wed, Jan 15, 2014 at 10:27:19AM -0800, Dmitry Shmidt wrote:
> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> @@ -6345,6 +6345,8 @@ static char * wpas_global_ctrl_iface_redir_p2p(struct wpa_global *global,
>  #ifdef CONFIG_P2P
>  	static const char * cmd[] = {
> +		"LIST_NETWORKS",
> +		"SAVE_CONFIG",

>  	static const char * prefix[] = {
> +#ifdef ANDROID
> +		"DRIVER ",
> +#endif
> +		"GET_NETWORK ",
> +		"REMOVE_NETWORK ",
> +		"SET ",

Thanks, applied. Though, I want to make sure it is understood that these
commands are not explicitly for P2P uses and they may even be used for
per-interface operations. Doing such operations through the global
control interface without the IFNAME= prefix has undefined behavior and
that behavior may change. As such, I would not recommend using these for
anything else than operations that are clearly in global context (e.g.,
for P2P management purposes). I added that note to the commit message as
well.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Fri Jan 17 02:37:43 2014
From: j (Jouni Malinen)
Date: Fri, 17 Jan 2014 12:37:43 +0200
Subject: [PATCH v2] hwsim tests: vm: add optional time-warp
In-Reply-To: <1389815919-19067-1-git-send-email-johannes@sipsolutions.net>
References: <1389815919-19067-1-git-send-email-johannes@sipsolutions.net>
Message-ID: <20140117103743.GE14224@w1.fi>

On Wed, Jan 15, 2014 at 08:58:39PM +0100, Johannes Berg wrote:
> To test the code under the influence of time jumps, add the option
> (--timewarp) to the VM tests to reset the clock all the time, which
> makes the wall clock time jump speed up 20x, causing gettimeofday()
> to be unreliable for timeout calculations.

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From kurt.bodiker  Fri Jan 17 03:37:40 2014
From: kurt.bodiker (Kurt Bodiker)
Date: Fri, 17 Jan 2014 06:37:40 -0500
Subject: [PATCH 2/2] Update IE after association regardless driver roaming
	support
In-Reply-To: <20140117093249.GB6159@w1.fi>
References: <20140115183356.283101401FA@ushik.mtv.corp.google.com>
	<20140117093249.GB6159@w1.fi>
Message-ID: <CAOzu-jgEHqgAB=B-v+0XS=FLevmKCq93Rkvdjjdpr+m_yrmq=w@mail.gmail.com>

For what it's worth, this appears to have fixed the problem I am
experiencing of the scan results not being updated for the current_bss
when the SSID is hidden. With this patch in place, the value for
signal level changes as expected.

Kurt

On Fri, Jan 17, 2014 at 4:32 AM, Jouni Malinen <j at w1.fi> wrote:
> On Wed, Jan 15, 2014 at 10:30:12AM -0800, Dmitry Shmidt wrote:
>> Update IE is necessary if roaming is done by driver / FW, but will
>> not harm in other case
>
> Could you please clarify why this would not do harm in other cases? The
> WPA_DRIVER_FLAGS_BSS_SELECTION case is know to require this which is why
> the IE update code is there. However, it is not known whether there
> could be drivers that do not have correct information in scan results
> for all cases (e.g., some of the hidden SSID/multi-SSID cases could be a
> bit risky in this area). Consequently, I could see this change
> potentially breaking some working cases. Since I see no real
> justification for this change, I'd rather not add it.
>
> Drivers that do BSS selection in the driver/firmware better indicate
> that to the user space and the real fix here would be to make any driver
> that could today need this change work properly in this area. Working
> around them with a change in wpa_supplicant is not justifiable if there
> is risk in breaking something for other drivers.
>
> As far as being able to fix one known driver misbehavior in this area,
> there is already a change in upstream kernel moving ahead with the
> BSSID/frequency hint attributes. Once that hits wireless-testing.git, we
> can add the wpa_supplicant changes to provide that information to the
> driver even when WPA_DRIVER_FLAGS_BSS_SELECTION is advertised. That will
> hopefully remove any assumed need for not advertising this capability
> correctly.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap


From dimitrysh  Fri Jan 17 10:58:50 2014
From: dimitrysh (Dmitry Shmidt)
Date: Fri, 17 Jan 2014 10:58:50 -0800
Subject: [PATCH] P2P: Reduce peer expiration age to 60 sec and allow
	customization
Message-ID: <20140117192209.83D5413FF44@ushik.mtv.corp.google.com>

Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 src/p2p/p2p.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 138ba16..f2aa971 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -41,7 +41,9 @@ static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx);
  * P2P_PEER_EXPIRATION_AGE - Number of seconds after which inactive peer
  * entries will be removed
  */
-#define P2P_PEER_EXPIRATION_AGE 300
+#ifndef P2P_PEER_EXPIRATION_AGE
+#define P2P_PEER_EXPIRATION_AGE 60
+#endif
 
 #define P2P_PEER_EXPIRATION_INTERVAL (P2P_PEER_EXPIRATION_AGE / 2)
 
-- 
1.8.5.2



From dimitrysh  Fri Jan 17 14:12:19 2014
From: dimitrysh (Dmitry Shmidt)
Date: Fri, 17 Jan 2014 14:12:19 -0800
Subject: [PATCH 2/2] Update IE after association regardless driver roaming
	support
In-Reply-To: <20140117093249.GB6159@w1.fi>
References: <20140115183356.283101401FA@ushik.mtv.corp.google.com>
	<20140117093249.GB6159@w1.fi>
Message-ID: <CAH7ZN-xbDWS1t6XOTdr8eVQZ4HzaXxe0m2FdV2HiTMM3pPcrcw@mail.gmail.com>

On Fri, Jan 17, 2014 at 1:32 AM, Jouni Malinen <j at w1.fi> wrote:
> On Wed, Jan 15, 2014 at 10:30:12AM -0800, Dmitry Shmidt wrote:
>> Update IE is necessary if roaming is done by driver / FW, but will
>> not harm in other case
>
> Could you please clarify why this would not do harm in other cases?

It is possible that I am missing something but what I think is that
in assoc event it is maybe not necessary sometimes but definitely
safe to update current wpa IEs from wpa_s->current_bss.

I am trying to resolve the case when driver/FW is doing roaming but not
exporting WPA_DRIVER_FLAGS_BSS_SELECTION flag. Exporting this
flag causes for wpa_supplicant not to provide BSSID and Freq for association
request and this is slowing initial connection.

> The WPA_DRIVER_FLAGS_BSS_SELECTION case is know to require this which is why
> the IE update code is there. However, it is not known whether there
> could be drivers that do not have correct information in scan results
> for all cases (e.g., some of the hidden SSID/multi-SSID cases could be a
> bit risky in this area). Consequently, I could see this change
> potentially breaking some working cases. Since I see no real
> justification for this change, I'd rather not add it.
>
> Drivers that do BSS selection in the driver/firmware better indicate
> that to the user space and the real fix here would be to make any driver
> that could today need this change work properly in this area. Working
> around them with a change in wpa_supplicant is not justifiable if there
> is risk in breaking something for other drivers.
>
> As far as being able to fix one known driver misbehavior in this area,
> there is already a change in upstream kernel moving ahead with the
> BSSID/frequency hint attributes. Once that hits wireless-testing.git, we
> can add the wpa_supplicant changes to provide that information to the
> driver even when WPA_DRIVER_FLAGS_BSS_SELECTION is advertised. That will
> hopefully remove any assumed need for not advertising this capability
> correctly.
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap


From dcbw  Mon Jan 20 15:03:15 2014
From: dcbw (Dan Williams)
Date: Mon, 20 Jan 2014 17:03:15 -0600
Subject: [PATCH 1/3] supplicant: fix usage based on build options
Message-ID: <1390258995.8044.1.camel@dcbw.local>

Signed-hostap: Dan Williams <dcbw at redhat.com>
---
 wpa_supplicant/main.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/main.c b/wpa_supplicant/main.c
index 37f0c78..759b0ca 100644
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -18,20 +18,31 @@
 
 
 static void usage(void)
 {
 	int i;
 	printf("%s\n\n%s\n"
 	       "usage:\n"
-	       "  wpa_supplicant [-BddhKLqqstuvW] [-P<pid file>] "
+	       "  wpa_supplicant [-BddhKLqq"
+#ifdef CONFIG_DEBUG_SYSLOG
+	       "s"
+#endif
+	       "t"
+#ifdef CONFIG_DBUS
+	       "u"
+#endif
+	       "vW] [-P<pid file>] "
 	       "[-g<global ctrl>] \\\n"
 	       "        [-G<group>] \\\n"
 	       "        -i<ifname> -c<config file> [-C<ctrl>] [-D<driver>] "
 	       "[-p<driver_param>] \\\n"
-	       "        [-b<br_ifname>] [-f<debug file>] [-e<entropy file>] "
+	       "        [-b<br_ifname>] [-e<entropy file>]"
+#ifdef CONFIG_DEBUG_FILE
+	       " [-f<debug file>]"
+#endif
 	       "\\\n"
 	       "        [-o<override driver>] [-O<override ctrl>] \\\n"
 	       "        [-N -i<ifname> -c<conf> [-C<ctrl>] "
 	       "[-D<driver>] \\\n"
 	       "        [-p<driver_param>] [-b<br_ifname>] [-I<config file>] "
 	       "...]\n"
 	       "\n"
-- 
1.8.3.1




From dcbw  Mon Jan 20 15:04:03 2014
From: dcbw (Dan Williams)
Date: Mon, 20 Jan 2014 17:04:03 -0600
Subject: [PATCH 2/3] man: add manpage for eapol_test
Message-ID: <1390259043.8044.2.camel@dcbw.local>

Signed-hostap: Dan Williams <dcbw at redhat.com>
---
 wpa_supplicant/doc/docbook/Makefile        |   3 +-
 wpa_supplicant/doc/docbook/eapol_test.sgml | 205 +++++++++++++++++++++++++++++
 2 files changed, 207 insertions(+), 1 deletion(-)
 create mode 100644 wpa_supplicant/doc/docbook/eapol_test.sgml

diff --git a/wpa_supplicant/doc/docbook/Makefile b/wpa_supplicant/doc/docbook/Makefile
index aaeee2e..82f9de3 100644
--- a/wpa_supplicant/doc/docbook/Makefile
+++ b/wpa_supplicant/doc/docbook/Makefile
@@ -3,25 +3,26 @@ all: man html pdf
 FILES += wpa_background
 FILES += wpa_cli
 FILES += wpa_gui
 FILES += wpa_passphrase
 FILES += wpa_priv
 FILES += wpa_supplicant.conf
 FILES += wpa_supplicant
+FILES += eapol_test
 
 man:
 	for i in $(FILES); do docbook2man $$i.sgml; done
 
 html:
 	for i in $(FILES); do docbook2html $$i.sgml && \
 		mv index.html $$i.html; done
 
 pdf:
 	for i in $(FILES); do docbook2pdf $$i.sgml; done
 
 
 clean:
-	rm -f wpa_background.8 wpa_cli.8 wpa_gui.8 wpa_passphrase.8 wpa_priv.8 wpa_supplicant.8
+	rm -f wpa_background.8 wpa_cli.8 wpa_gui.8 wpa_passphrase.8 wpa_priv.8 wpa_supplicant.8 eapol_test.8
 	rm -f wpa_supplicant.conf.5
 	rm -f manpage.links manpage.refs
 	rm -f $(FILES:%=%.pdf)
 	rm -f $(FILES:%=%.html)
diff --git a/wpa_supplicant/doc/docbook/eapol_test.sgml b/wpa_supplicant/doc/docbook/eapol_test.sgml
new file mode 100644
index 0000000..6ee041f
--- /dev/null
+++ b/wpa_supplicant/doc/docbook/eapol_test.sgml
@@ -0,0 +1,205 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
+
+<refentry>
+  <refmeta>
+    <refentrytitle>eapol_test</refentrytitle>
+    <manvolnum>8</manvolnum>
+  </refmeta>
+  <refnamediv>
+    <refname>eapol_test</refname>
+
+    <refpurpose>EAP peer and RADIUS client testing</refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>eapol_test</command>
+      <arg>-nWS</arg>
+      <arg>-c<replaceable>config file</replaceable></arg>
+      <arg>-a<replaceable>server IP address</replaceable></arg>
+      <arg>-A<replaceable>client IP address</replaceable></arg>
+      <arg>-p<replaceable>UDP port</replaceable></arg>
+      <arg>-s<replaceable>shared secret</replaceable></arg>
+      <arg>-r<replaceable>re-authentications</replaceable></arg>
+      <arg>-t<replaceable>timeout</replaceable></arg>
+      <arg>-C<replaceable>Connect-Info</replaceable></arg>
+      <arg>-M<replaceable>MAC address</replaceable></arg>
+      <arg>-o<replaceable>file</replaceable></arg>
+      <arg>-N<replaceable>attr spec</replaceable></arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>eapol_test scard</command>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>eapol_test sim</command>
+      <arg>PIN</arg>
+      <arg>num triplets</arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Overview</title>
+
+    <para>eapol_test is a program that links together the same EAP
+    peer implementation that wpa_supplicant is using and the RADIUS
+    authentication client code from hostapd. In addition, it has
+    minimal glue code to combine these two components in similar
+    ways to IEEE 802.1X/EAPOL Authenticator state machines. In other
+    words, it integrates IEEE 802.1X Authenticator (normally, an
+    access point) and IEEE 802.1X Supplicant (normally, a wireless
+    client) together to generate a single program that can be used to
+    test EAP methods without having to setup an access point and a
+    wireless client.</para>
+
+    <para>The main uses for eapol_test are in interoperability testing
+    of EAP methods against RADIUS servers and in development testing
+    for new EAP methods. It can be easily used to automate EAP testing
+    for interoperability and regression since the program can be run
+    from shell scripts without require additional test components apart
+    from a RADIUS server. For example, the automated EAP tests described
+    in eap_testing.txt are implemented with eapol_test. Similarly,
+    eapol_test could be used to implement an automated regression
+    test suite for a RADIUS authentication server.</para>
+
+
+    <para>As an example:</para>
+
+<blockquote><programlisting>
+eapol_test -ctest.conf -a127.0.0.1 -p1812 -ssecret -r1
+</programlisting></blockquote>
+
+    <para>tries to complete EAP authentication based on the network
+    configuration from test.conf against the RADIUS server running
+    on the local host. A re-authentication is triggered to test fast
+    re-authentication. The configuration file uses the same format for
+    network blocks as wpa_supplicant.</para>
+
+  </refsect1>
+  <refsect1>
+    <title>Command Arguments</title>
+    <variablelist>
+      <varlistentry>
+	<term>-c configuration file path</term>
+
+	<listitem><para>A configuration to use.  The configuration should
+	use the same format for network blocks as wpa_supplicant.
+	</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-a AS address</term>
+
+	<listitem><para>IP address of the authentication server.  The
+	default is '127.0.0.1'.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-A client address</term>
+
+	<listitem><para>IP address of the client.  The default is to
+	select an address automatically.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-p AS port</term>
+
+        <listitem><para>UDP port of the authentication server. The
+        default is '1812'.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-s AS secret</term>
+
+	<listitem><para>Shared secret with the authentication server.
+	The default is 'radius'.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-r count</term>
+
+	<listitem><para>Number of reauthentications.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-t timeout</term>
+
+	<listitem><para>Timeout in seconds. The default is 30.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-C info</term>
+
+	<listitem><para>RADIUS Connect-Info.  The default is
+	'CONNECT 11Mbps 802.11b'.</para></listitem>
+      </varlistentry>
+
+
+      <varlistentry>
+	<term>-M mac address</term>
+
+	<listitem><para>Client MAC address (Calling-Station-Id).  The
+	default is '02:00:00:00:00:01'.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-o file</term>
+
+	<listitem><para>Location to write out server certificate.
+	</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-N attr spec</term>
+
+	<listitem><para>Send arbitrary attribute specific by
+	attr_id:syntax:value, or attr_id alone.  attr_id should be the numeric
+	ID of the attribute, and syntax should be one of 's' (string),
+	'd' (integer), or 'x' (octet string). The value is the attribute value
+	to send.  When attr_id is given alone, NULL is used as the attribute
+	value.  Multiple attributes can be specified by using the option
+	several times.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-n</term>
+
+	<listitem><para>Indicates that no MPPE keys are expected.
+	</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-W</term>
+
+	<listitem><para>Wait for a control interface monitor before starting.
+	</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-S</term>
+
+	<listitem><para>Save configuration after authentication.
+	</para></listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+  <refsect1>
+    <title>See Also</title>
+    <para>
+      <citerefentry>
+	<refentrytitle>wpa_supplicant</refentrytitle>
+	<manvolnum>8</manvolnum>
+      </citerefentry>
+    </para>
+  </refsect1>
+  <refsect1>
+    <title>Legal</title>
+    <para>wpa_supplicant is copyright (c) 2003-2014,
+    Jouni Malinen <email>j at w1.fi</email> and
+    contributors.
+    All Rights Reserved.</para>
+
+    <para>This program is licensed under the BSD license (the one with
+    advertisement clause removed).</para>
+  </refsect1>
+</refentry>
-- 
1.8.3.1




From dcbw  Mon Jan 20 15:11:31 2014
From: dcbw (Dan Williams)
Date: Mon, 20 Jan 2014 17:11:31 -0600
Subject: [PATCH 3/3] man: sync manpages and command-line options
Message-ID: <1390259491.8044.5.camel@dcbw.local>

From: Dan Winship <danw at redhat.com>

Signed-hostap: Dan Williams <dcbw at redhat.com>
---
 wpa_supplicant/doc/docbook/wpa_cli.sgml        | 17 +++++++
 wpa_supplicant/doc/docbook/wpa_supplicant.sgml | 65 ++++++++++++++++++++++++--
 2 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/wpa_supplicant/doc/docbook/wpa_cli.sgml b/wpa_supplicant/doc/docbook/wpa_cli.sgml
index c080c07..f79557e 100644
--- a/wpa_supplicant/doc/docbook/wpa_cli.sgml
+++ b/wpa_supplicant/doc/docbook/wpa_cli.sgml
@@ -11,18 +11,20 @@
     <refpurpose>WPA command line client</refpurpose>
   </refnamediv>
 
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>wpa_cli</command>
       <arg>-p <replaceable>path to ctrl sockets</replaceable></arg>
+      <arg>-g <replaceable>path to global ctrl_interface socket</replaceable></arg>
       <arg>-i <replaceable>ifname</replaceable></arg>
       <arg>-hvB</arg>
       <arg>-a <replaceable>action file</replaceable></arg>
       <arg>-P <replaceable>pid file</replaceable></arg>
+      <arg>-G <replaceable>ping interval</replaceable></arg>
       <arg><replaceable>command ...</replaceable></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
 
   <refsect1>
     <title>Overview</title>
 
@@ -107,14 +109,22 @@ CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
 	<term>-p path</term>
 
 	<listitem><para>Change the path where control sockets should
 	be found.</para></listitem>
       </varlistentry>
 
       <varlistentry>
+	<term>-g control socket path</term>
+
+	<listitem><para>Connect to the global control socket at the
+	indicated path rather than an interface-specific control
+	socket.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
 	<term>-i ifname</term>
 
         <listitem><para>Specify the interface that is being
 	configured.  By default, choose the first interface found with
 	a control socket in the socket path.</para></listitem>
       </varlistentry>
 
@@ -157,14 +167,21 @@ CTRL-REQ-OTP-2:Challenge 1235663 needed for SSID foobar
 	<term>-P file</term>
 
 	<listitem><para>Set the location of the PID
 	file.</para></listitem>
       </varlistentry>
 
       <varlistentry>
+	<term>-G ping interval</term>
+
+	<listitem><para>Set the interval (in seconds) at which
+	wpa_cli pings the supplicant.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
 	<term>command</term>
 
 	<listitem><para>Run a command.  The available commands are
 	listed in the next section.</para></listitem>
 
       </varlistentry>
     </variablelist>
diff --git a/wpa_supplicant/doc/docbook/wpa_supplicant.sgml b/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
index aa20e57..ac2b39d 100644
--- a/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
+++ b/wpa_supplicant/doc/docbook/wpa_supplicant.sgml
@@ -8,15 +8,15 @@
   <refnamediv>
     <refname>wpa_supplicant</refname>
     <refpurpose>Wi-Fi Protected Access client and IEEE 802.1X supplicant</refpurpose>
   </refnamediv>
   <refsynopsisdiv>
     <cmdsynopsis>
       <command>wpa_supplicant</command>
-      <arg>-BddfhKLqqtuvW</arg>
+      <arg>-BddfhKLqqsTtuvW</arg>
       <arg>-i<replaceable>ifname</replaceable></arg>
       <arg>-c<replaceable>config file</replaceable></arg>
       <arg>-D<replaceable>driver</replaceable></arg>
       <arg>-P<replaceable>PID_file</replaceable></arg>
       <arg>-f<replaceable>output file</replaceable></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -340,17 +340,28 @@
 	<listitem>
 	  <para>Driver to use (can be multiple drivers: nl80211,wext).
 		  (Per interface, see the available options below.)</para>
 	</listitem>
       </varlistentry>
 
       <varlistentry>
+	<term>-e entropy file</term>
+	<listitem>
+	  <para>File for <command>wpa_supplicant</command> to use to
+	  maintain its internal entropy store in over restarts.</para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
 	<term>-f output file</term>
 	<listitem>
-	  <para>Log output to specified file instead of stdout.</para>
+	  <para>Log output to specified file instead of stdout. (This
+	  is only available if <command>wpa_supplicant</command> was
+	  built with the <literal>CONFIG_DEBUG_FILE</literal>
+	  option.)</para>
 	</listitem>
       </varlistentry>
 
       <varlistentry>
 	<term>-g global ctrl_interface</term>
 	<listitem>
 	  <para>Path to global ctrl_interface socket. If specified, interface
@@ -383,14 +394,30 @@
 	<term>-L</term>
 	<listitem>
 	  <para>Show license (BSD).</para>
 	</listitem>
       </varlistentry>
 
       <varlistentry>
+	<term>-o override driver</term>
+	<listitem>
+	  <para>Override the driver parameter for new
+	  interfaces.</para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-O override ctrl_interface</term>
+	<listitem>
+	  <para>Override the ctrl_interface parameter for new
+	  interfaces.</para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
 	<term>-p</term>
 	<listitem>
 	  <para>Driver parameters. (Per interface)</para>
 	</listitem>
       </varlistentry>
 
       <varlistentry>
@@ -405,18 +432,48 @@
 	<listitem>
 	  <para>Decrease debugging verbosity (<option>-qq</option> even
 		  less).</para>
 	</listitem>
       </varlistentry>
 
       <varlistentry>
+	<term>-s</term>
+	<listitem>
+	  <para>Log output to syslog instead of stdout. (This is only
+	  available if <command>wpa_supplicant</command> was built
+	  with the <literal>CONFIG_DEBUG_SYSLOG</literal>
+	  option.)</para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-T</term>
+	<listitem>
+	  <para>Log output to Linux tracing in addition to any other
+	  destinations. (This is only available
+	  if <command>wpa_supplicant</command> was built with
+	  the <literal>CONFIG_DEBUG_LINUX_TRACING</literal>
+	  option.)</para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>-t</term>
+	<listitem>
+	  <para>Include timestamp in debug messages.</para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
 	<term>-u</term>
 	<listitem>
-	  <para>Enabled DBus control interface. If enabled, interface
-	  definitions may be omitted.</para>
+	  <para>Enable DBus control interface. If enabled, interface
+	  definitions may be omitted. (This is only available
+	  if <command>wpa_supplicant</command> was built with
+	  the <literal>CONFIG_DBUS</literal> option.)</para>0
 	</listitem>
       </varlistentry>
 
       <varlistentry>
 	<term>-v</term>
 	<listitem>
 	  <para>Show version.</para>
-- 
1.8.3.1




From michal.kazior  Mon Jan 20 22:57:22 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:22 +0100
Subject: [RFC 0/6] hostapd: implement multi-interface CSA
Message-ID: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>

Hi,

This is the userspace part of my multi-interface
CSA patchset. I've already posted some kernel
related patches to the linux-wireless mailing
list.

I'm posting this as an RFC instead of a PATCH
since kernel changes are yet to be accepted &
merged.

Patch 5 is more of a convienence for testing and a
hint that nl80211 must be updated if the patchset
is applied at some later point in time.

For convienence hostap and kernel trees are
available at:

 https://github.com/kazikcz/linux/tree/multi-interface-csa-review-2014-01-20-1
 https://github.com/kazikcz/hostap/tree/multi-interface-csa-review-2014-01-20-1


Michal Kazior (6):
  hostapd: move CSA structures to hostapd_data
  hostapd: extend CSA driver API
  hostapd: use extended CSA interface for chan_switch cmd
  hostapd: submit multi-interface CSA requests for DFS
  nl80211: add new nl80211 attributes
  nl80211: implement multi-interface CSA

 hostapd/ctrl_iface.c         |  21 +++++-
 src/ap/ap_drv_ops.h          |  14 +++-
 src/ap/beacon.c              |  20 +++---
 src/ap/dfs.c                 |  83 ++++++++++++++++-------
 src/ap/drv_callbacks.c       |   6 +-
 src/ap/hostapd.c             |  69 ++++++++++---------
 src/ap/hostapd.h             |  19 +++---
 src/drivers/driver.h         |  11 +++-
 src/drivers/driver_nl80211.c | 153 ++++++++++++++++++++++++++++++-------------
 src/drivers/nl80211_copy.h   |   7 ++
 wpa_supplicant/ap.c          |   5 +-
 11 files changed, 281 insertions(+), 127 deletions(-)

-- 
1.8.4.rc3



From michal.kazior  Mon Jan 20 22:57:23 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:23 +0100
Subject: [RFC 1/6] hostapd: move CSA structures to hostapd_data
In-Reply-To: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
References: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390287448-7718-2-git-send-email-michal.kazior@tieto.com>

This prepares CSA structure and logic in hostapd
for multi-BSS support.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/ap/beacon.c              | 20 ++++++++++----------
 src/ap/drv_callbacks.c       |  6 ++++--
 src/ap/hostapd.c             | 40 ++++++++++++++++++++--------------------
 src/ap/hostapd.h             | 16 ++++++++--------
 src/drivers/driver_nl80211.c |  4 ++--
 5 files changed, 44 insertions(+), 42 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 5318ecb..e32d60f 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -200,18 +200,18 @@ static u8 * hostapd_eid_csa(struct hostapd_data *hapd, u8 *eid)
 {
 	u8 chan;
 
-	if (!hapd->iface->cs_freq_params.freq)
+	if (!hapd->cs_freq_params.freq)
 		return eid;
 
-	if (ieee80211_freq_to_chan(hapd->iface->cs_freq_params.freq, &chan) ==
+	if (ieee80211_freq_to_chan(hapd->cs_freq_params.freq, &chan) ==
 	    NUM_HOSTAPD_MODES)
 		return eid;
 
 	*eid++ = WLAN_EID_CHANNEL_SWITCH;
 	*eid++ = 3;
-	*eid++ = hapd->iface->cs_block_tx;
+	*eid++ = hapd->cs_block_tx;
 	*eid++ = chan;
-	*eid++ = hapd->iface->cs_count;
+	*eid++ = hapd->cs_count;
 
 	return eid;
 }
@@ -221,12 +221,12 @@ static u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid)
 {
 	u8 sec_ch;
 
-	if (!hapd->iface->cs_freq_params.sec_channel_offset)
+	if (!hapd->cs_freq_params.sec_channel_offset)
 		return eid;
 
-	if (hapd->iface->cs_freq_params.sec_channel_offset == -1)
+	if (hapd->cs_freq_params.sec_channel_offset == -1)
 		sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
-	else if (hapd->iface->cs_freq_params.sec_channel_offset == 1)
+	else if (hapd->cs_freq_params.sec_channel_offset == 1)
 		sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
 	else
 		return eid;
@@ -341,7 +341,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 	pos = hostapd_eid_roaming_consortium(hapd, pos);
 
 	pos = hostapd_add_csa_elems(hapd, pos, (u8 *)resp,
-				    &hapd->iface->cs_c_off_proberesp);
+				    &hapd->cs_c_off_proberesp);
 #ifdef CONFIG_IEEE80211AC
 	pos = hostapd_eid_vht_capabilities(hapd, pos);
 	pos = hostapd_eid_vht_operation(hapd, pos);
@@ -753,7 +753,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_eid_adv_proto(hapd, tailpos);
 	tailpos = hostapd_eid_roaming_consortium(hapd, tailpos);
 	tailpos = hostapd_add_csa_elems(hapd, tailpos, tail,
-					&hapd->iface->cs_c_off_beacon);
+					&hapd->cs_c_off_beacon);
 #ifdef CONFIG_IEEE80211AC
 	tailpos = hostapd_eid_vht_capabilities(hapd, tailpos);
 	tailpos = hostapd_eid_vht_operation(hapd, tailpos);
@@ -878,7 +878,7 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
 	struct wpabuf *beacon, *proberesp, *assocresp;
 	int res, ret = -1;
 
-	if (hapd->iface->csa_in_progress) {
+	if (hapd->csa_in_progress) {
 		wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period");
 		return -1;
 	}
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 9af9646..bca7d32 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -30,6 +30,7 @@
 #include "ap_config.h"
 #include "hw_features.h"
 #include "dfs.h"
+#include "beacon.h"
 
 
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
@@ -440,9 +441,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 	hapd->iconf->vht_oper_centr_freq_seg0_idx = seg0_idx;
 	hapd->iconf->vht_oper_centr_freq_seg1_idx = seg1_idx;
 
-	if (hapd->iface->csa_in_progress &&
-	    freq == hapd->iface->cs_freq_params.freq) {
+	if (hapd->csa_in_progress &&
+	    freq == hapd->cs_freq_params.freq) {
 		hostapd_cleanup_cs_params(hapd);
+		ieee802_11_set_beacon(hapd);
 
 		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED "freq=%d",
 			freq);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 44d05c5..b0a859f 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2040,13 +2040,12 @@ static void free_beacon_data(struct beacon_data *beacon)
 }
 
 
-static int hostapd_build_beacon_data(struct hostapd_iface *iface,
+static int hostapd_build_beacon_data(struct hostapd_data *hapd,
 				     struct beacon_data *beacon)
 {
 	struct wpabuf *beacon_extra, *proberesp_extra, *assocresp_extra;
 	struct wpa_driver_ap_params params;
 	int ret;
-	struct hostapd_data *hapd = iface->bss[0];
 
 	os_memset(beacon, 0, sizeof(*beacon));
 	ret = ieee802_11_build_ap_params(hapd, &params);
@@ -2170,14 +2169,15 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
+static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
 				     struct csa_settings *settings)
 {
+	struct hostapd_iface *iface = hapd->iface;
 	struct hostapd_freq_params old_freq;
 	int ret;
 
 	os_memset(&old_freq, 0, sizeof(old_freq));
-	if (!iface || !iface->freq || iface->csa_in_progress)
+	if (!iface || !iface->freq || hapd->csa_in_progress)
 		return -1;
 
 	ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
@@ -2186,7 +2186,7 @@ static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
 	if (ret)
 		return ret;
 
-	ret = hostapd_build_beacon_data(iface, &settings->beacon_after);
+	ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
 
 	/* change back the configuration */
 	hostapd_change_config_freq(iface->bss[0], iface->conf,
@@ -2196,18 +2196,18 @@ static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
 		return ret;
 
 	/* set channel switch parameters for csa ie */
-	iface->cs_freq_params = settings->freq_params;
-	iface->cs_count = settings->cs_count;
-	iface->cs_block_tx = settings->block_tx;
+	hapd->cs_freq_params = settings->freq_params;
+	hapd->cs_count = settings->cs_count;
+	hapd->cs_block_tx = settings->block_tx;
 
-	ret = hostapd_build_beacon_data(iface, &settings->beacon_csa);
+	ret = hostapd_build_beacon_data(hapd, &settings->beacon_csa);
 	if (ret) {
 		free_beacon_data(&settings->beacon_after);
 		return ret;
 	}
 
-	settings->counter_offset_beacon = iface->cs_c_off_beacon;
-	settings->counter_offset_presp = iface->cs_c_off_proberesp;
+	settings->counter_offset_beacon = hapd->cs_c_off_beacon;
+	settings->counter_offset_presp = hapd->cs_c_off_proberesp;
 
 	return 0;
 }
@@ -2215,13 +2215,13 @@ static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
 
 void hostapd_cleanup_cs_params(struct hostapd_data *hapd)
 {
-	os_memset(&hapd->iface->cs_freq_params, 0,
-		  sizeof(hapd->iface->cs_freq_params));
-	hapd->iface->cs_count = 0;
-	hapd->iface->cs_block_tx = 0;
-	hapd->iface->cs_c_off_beacon = 0;
-	hapd->iface->cs_c_off_proberesp = 0;
-	hapd->iface->csa_in_progress = 0;
+	os_memset(&hapd->cs_freq_params, 0,
+		  sizeof(hapd->cs_freq_params));
+	hapd->cs_count = 0;
+	hapd->cs_block_tx = 0;
+	hapd->cs_c_off_beacon = 0;
+	hapd->cs_c_off_proberesp = 0;
+	hapd->csa_in_progress = 0;
 }
 
 
@@ -2229,7 +2229,7 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
 			   struct csa_settings *settings)
 {
 	int ret;
-	ret = hostapd_fill_csa_settings(hapd->iface, settings);
+	ret = hostapd_fill_csa_settings(hapd, settings);
 	if (ret)
 		return ret;
 
@@ -2243,7 +2243,7 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
 		return ret;
 	}
 
-	hapd->iface->csa_in_progress = 1;
+	hapd->csa_in_progress = 1;
 	return 0;
 }
 
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 489ab16..993def0 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -213,6 +213,14 @@ struct hostapd_data {
 			   size_t psk_len);
 	void *new_psk_cb_ctx;
 
+	/* channel switch parameters */
+	struct hostapd_freq_params cs_freq_params;
+	u8 cs_count;
+	int cs_block_tx;
+	unsigned int cs_c_off_beacon;
+	unsigned int cs_c_off_proberesp;
+	int csa_in_progress;
+
 #ifdef CONFIG_P2P
 	struct p2p_data *p2p;
 	struct p2p_group *p2p_group;
@@ -337,14 +345,6 @@ struct hostapd_iface {
 	/* lowest observed noise floor in dBm */
 	s8 lowest_nf;
 
-	/* channel switch parameters */
-	struct hostapd_freq_params cs_freq_params;
-	u8 cs_count;
-	int cs_block_tx;
-	unsigned int cs_c_off_beacon;
-	unsigned int cs_c_off_proberesp;
-	int csa_in_progress;
-
 #ifdef CONFIG_ACS
 	unsigned int acs_num_completed_scans;
 #endif /* CONFIG_ACS */
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index fce6efd..8c8ad51 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1605,7 +1605,7 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
 
 	bss->freq = data.ch_switch.freq;
 
-	wpa_supplicant_event(drv->ctx, EVENT_CH_SWITCH, &data);
+	wpa_supplicant_event(bss->ctx, EVENT_CH_SWITCH, &data);
 }
 
 
@@ -11433,7 +11433,7 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 		return -ENOMEM;
 
 	nl80211_cmd(drv, msg, 0, NL80211_CMD_CHANNEL_SWITCH);
-	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
 	NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count);
 	ret = nl80211_put_freq_params(msg, &settings->freq_params);
 	if (ret)
-- 
1.8.4.rc3



From michal.kazior  Mon Jan 20 22:57:24 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:24 +0100
Subject: [RFC 2/6] hostapd: extend CSA driver API
In-Reply-To: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
References: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390287448-7718-3-git-send-email-michal.kazior@tieto.com>

This prepares CSA driver API to support multi-BSS.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 hostapd/ctrl_iface.c         |  5 ++++-
 src/ap/ap_drv_ops.h          | 14 +++++++++++---
 src/ap/dfs.c                 |  4 +++-
 src/ap/hostapd.c             | 35 ++++++++++++++++++++++-------------
 src/ap/hostapd.h             |  3 +--
 src/drivers/driver.h         | 11 +++++++++--
 src/drivers/driver_nl80211.c |  7 ++++++-
 wpa_supplicant/ap.c          |  5 ++++-
 8 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 72faeae..a73a1d5 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1077,7 +1077,10 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_data *hapd, char *pos)
 	if (ret)
 		return ret;
 
-	return hostapd_switch_channel(hapd, &settings);
+	settings.hapd = hapd;
+	settings.priv = hapd->drv_priv;
+
+	return hostapd_switch_channel(&settings, 1);
 #else /* NEED_AP_MLME */
 	return -1;
 #endif /* NEED_AP_MLME */
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 15a4b26..a729d7c 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -263,13 +263,21 @@ static inline const char * hostapd_drv_get_radio_name(struct hostapd_data *hapd)
 	return hapd->driver->get_radio_name(hapd->drv_priv);
 }
 
-static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
-					     struct csa_settings *settings)
+static inline int hostapd_drv_switch_channel(struct csa_settings *settings,
+					     int num_settings)
 {
+	struct hostapd_data *hapd;
+
+	if (num_settings < 1)
+		return -EINVAL;
+
+	hapd = settings[0].hapd;
+
 	if (hapd->driver == NULL || hapd->driver->switch_channel == NULL)
 		return -ENOTSUP;
 
-	return hapd->driver->switch_channel(hapd->drv_priv, settings);
+	return hapd->driver->switch_channel(hapd->drv_priv, settings,
+					    num_settings);
 }
 
 static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index caf4092..6037951 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -708,6 +708,8 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 
 	/* Setup CSA request */
 	os_memset(&csa_settings, 0, sizeof(csa_settings));
+	csa_settings.hapd = hapd;
+	csa_settings.priv = hapd->drv_priv;
 	csa_settings.cs_count = 5;
 	csa_settings.block_tx = 1;
 	err = hostapd_set_freq_params(&csa_settings.freq_params,
@@ -728,7 +730,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 		return err;
 	}
 
-	err = hostapd_switch_channel(hapd, &csa_settings);
+	err = hostapd_switch_channel(&csa_settings, 1);
 	if (err) {
 		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback",
 			   err);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index b0a859f..d4d032d 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2169,9 +2169,9 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
-				     struct csa_settings *settings)
+static int hostapd_fill_csa_settings(struct csa_settings *settings)
 {
+	struct hostapd_data *hapd = settings->hapd;
 	struct hostapd_iface *iface = hapd->iface;
 	struct hostapd_freq_params old_freq;
 	int ret;
@@ -2225,25 +2225,34 @@ void hostapd_cleanup_cs_params(struct hostapd_data *hapd)
 }
 
 
-int hostapd_switch_channel(struct hostapd_data *hapd,
-			   struct csa_settings *settings)
+int hostapd_switch_channel(struct csa_settings *settings,
+			   int num_settings)
 {
-	int ret;
-	ret = hostapd_fill_csa_settings(hapd, settings);
-	if (ret)
-		return ret;
+	int i, ret;
+
+	for (i = 0; i < num_settings; i++) {
+		ret = hostapd_fill_csa_settings(&settings[i]);
+		if (ret)
+			return ret;
+	}
 
-	ret = hostapd_drv_switch_channel(hapd, settings);
-	free_beacon_data(&settings->beacon_csa);
-	free_beacon_data(&settings->beacon_after);
+	ret = hostapd_drv_switch_channel(settings, num_settings);
+
+	for (i = 0; i < num_settings; i++) {
+		free_beacon_data(&settings[i].beacon_csa);
+		free_beacon_data(&settings[i].beacon_after);
+	}
 
 	if (ret) {
 		/* if we failed, clean cs parameters */
-		hostapd_cleanup_cs_params(hapd);
+		for (i = 0; i < num_settings; i++)
+			hostapd_cleanup_cs_params(settings[i].hapd);
 		return ret;
 	}
 
-	hapd->csa_in_progress = 1;
+	for (i = 0; i < num_settings; i++)
+		settings[i].hapd->csa_in_progress = 1;
+
 	return 0;
 }
 
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 993def0..3510911 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -391,8 +391,7 @@ int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
 const char * hostapd_state_text(enum hostapd_iface_state s);
-int hostapd_switch_channel(struct hostapd_data *hapd,
-			   struct csa_settings *settings);
+int hostapd_switch_channel(struct csa_settings *settings, int num_settings);
 void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
 
 /* utils.c */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index db34ed1..3a9b82c 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1209,6 +1209,8 @@ struct beacon_data {
 
 /**
  * struct csa_settings - Settings for channel switch command
+ * @hapd: Pointer to hostapd context
+ * @priv: Pointer to driver-specific context.
  * @cs_count: Count in Beacon frames (TBTT) to perform the switch
  * @block_tx: 1 - block transmission for CSA period
  * @freq_params: Next channel frequency parameter
@@ -1218,6 +1220,9 @@ struct beacon_data {
  * @counter_offset_presp: Offset to the count field in probe resp.
  */
 struct csa_settings {
+	struct hostapd_data *hapd;
+	void *priv;
+
 	u8 cs_count;
 	u8 block_tx;
 
@@ -2618,13 +2623,15 @@ struct wpa_driver_ops {
 	 * switch_channel - Announce channel switch and migrate the GO to the
 	 * given frequency
 	 * @priv: Private driver interface data
-	 * @settings: Settings for CSA period and new channel
+	 * @settings: Settings for CSA period and new channel for multiple BSSes
+	 * @num_settings: Number of CSA settings for different BSSes
 	 * Returns: 0 on success, -1 on failure
 	 *
 	 * This function is used to move the GO to the legacy STA channel to
 	 * avoid frequency conflict in single channel concurrency.
 	 */
-	int (*switch_channel)(void *priv, struct csa_settings *settings);
+	int (*switch_channel)(void *priv, struct csa_settings *settings,
+			      int num_settings);
 
 	/**
 	 * start_dfs_cac - Listen for radar interference on the channel
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 8c8ad51..94c2164 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11390,7 +11390,8 @@ nla_put_failure:
 }
 
 
-static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
+static int nl80211_switch_channel(void *priv, struct csa_settings *settings,
+				  int num_settings)
 {
 	struct nl_msg *msg;
 	struct i802_bss *bss = priv;
@@ -11398,6 +11399,10 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 	struct nlattr *beacon_csa;
 	int ret = -ENOBUFS;
 
+	/* multi-BSS not implemented yet */
+	if (num_settings != 1)
+		return -EOPNOTSUPP;
+
 	wpa_printf(MSG_DEBUG, "nl80211: Channel switch request (cs_count=%u block_tx=%u freq=%d width=%d cf1=%d cf2=%d)",
 		   settings->cs_count, settings->block_tx,
 		   settings->freq_params.freq, settings->freq_params.bandwidth,
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index ea4e6bb..9dbe0b0 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1068,7 +1068,10 @@ int ap_switch_channel(struct wpa_supplicant *wpa_s,
 	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
 		return -1;
 
-	return hostapd_switch_channel(wpa_s->ap_iface->bss[0], settings);
+	settings->hapd = wpa_s->ap_iface->bss[0];
+	settings->priv = wpa_s->ap_iface->bss[0]->drv_priv;
+
+	return hostapd_switch_channel(settings, 1);
 #else /* NEED_AP_MLME */
 	return -1;
 #endif /* NEED_AP_MLME */
-- 
1.8.4.rc3



From michal.kazior  Mon Jan 20 22:57:26 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:26 +0100
Subject: [RFC 4/6] hostapd: submit multi-interface CSA requests for DFS
In-Reply-To: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
References: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390287448-7718-5-git-send-email-michal.kazior@tieto.com>

When a radar is detecteed all BSSes sharing a
channel should switch. Switching a single
interface when multiple interfaces are running
wouldn't have worked with todays drivers anyway.

This also changes behaviour when CSA param setup
fails. Instead of disabling the hostapd_iface
fallback is tried (i.e. disable -> enable).

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/ap/dfs.c | 85 +++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 61 insertions(+), 24 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 6037951..26255ed 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -669,6 +669,56 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
 }
 
 
+static struct csa_settings *
+hostapd_dfs_get_csa_settings(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)
+{
+	struct csa_settings *csa_settings;
+	int err, i;
+
+	csa_settings = os_malloc(sizeof(*csa_settings) * iface->num_bss);
+	if (!csa_settings)
+		return NULL;
+
+	memset(csa_settings, 0, sizeof(*csa_settings) * iface->num_bss);
+
+	for (i = 0; i < iface->num_bss; i++) {
+		struct hostapd_data *hapd = iface->bss[i];
+
+		csa_settings[i].hapd = hapd;
+		csa_settings[i].priv = hapd->drv_priv;
+		csa_settings[i].block_tx = 1;
+
+		/* FIXME: compute this depending on regulatory domain and
+		 * beacon interval to match regulatory quiescing requirements
+		 */
+		csa_settings[i].cs_count = 5;
+
+		err = hostapd_set_freq_params(&csa_settings[i].freq_params,
+					      iface->conf->hw_mode,
+					      channel->freq,
+					      channel->chan,
+					      hapd->iconf->ieee80211n,
+					      hapd->iconf->ieee80211ac,
+					      secondary_channel,
+					      hapd->iconf->vht_oper_chwidth,
+					      vht_oper_centr_freq_seg0_idx,
+					      vht_oper_centr_freq_seg1_idx,
+					      iface->current_mode->vht_capab);
+		if (err) {
+			wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
+			os_free(csa_settings);
+			return NULL;
+		}
+	}
+
+	return csa_settings;
+}
+
+
 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 {
 	struct hostapd_channel_data *channel;
@@ -676,8 +726,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 	u8 vht_oper_centr_freq_seg0_idx;
 	u8 vht_oper_centr_freq_seg1_idx;
 	int skip_radar = 1;
-	struct csa_settings csa_settings;
-	struct hostapd_data *hapd = iface->bss[0];
+	struct csa_settings *csa_settings;
 	int err = 1;
 
 	wpa_printf(MSG_DEBUG, "%s called (CAC active: %s)", __func__,
@@ -707,30 +756,18 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 		channel->chan, secondary_channel);
 
 	/* Setup CSA request */
-	os_memset(&csa_settings, 0, sizeof(csa_settings));
-	csa_settings.hapd = hapd;
-	csa_settings.priv = hapd->drv_priv;
-	csa_settings.cs_count = 5;
-	csa_settings.block_tx = 1;
-	err = hostapd_set_freq_params(&csa_settings.freq_params,
-				      iface->conf->hw_mode,
-				      channel->freq,
-				      channel->chan,
-				      iface->conf->ieee80211n,
-				      iface->conf->ieee80211ac,
-				      secondary_channel,
-				      iface->conf->vht_oper_chwidth,
-				      vht_oper_centr_freq_seg0_idx,
-				      vht_oper_centr_freq_seg1_idx,
-				      iface->current_mode->vht_capab);
-
-	if (err) {
-		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
-		hostapd_disable_iface(iface);
-		return err;
+	csa_settings = hostapd_dfs_get_csa_settings(iface, channel,
+						    secondary_channel,
+						    vht_oper_centr_freq_seg0_idx,
+						    vht_oper_centr_freq_seg1_idx);
+
+	if (csa_settings) {
+		err = hostapd_switch_channel(csa_settings, iface->num_bss);
+		os_free(csa_settings);
+	} else {
+		err = -1; /* just try fallback */
 	}
 
-	err = hostapd_switch_channel(&csa_settings, 1);
 	if (err) {
 		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback",
 			   err);
-- 
1.8.4.rc3



From michal.kazior  Mon Jan 20 22:57:25 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:25 +0100
Subject: [RFC 3/6] hostapd: use extended CSA interface for chan_switch cmd
In-Reply-To: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
References: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390287448-7718-4-git-send-email-michal.kazior@tieto.com>

By default if there are multiple interfaces
running try multi-interface CSA. This is most
likely what the user wants anyway.

Moving a single interface with nl80211 when others
are running wouldn't have worked anyway (assuming
kernel driver supports multi-channel) since
operating frequency is shared across interfaces in
nl80211 backend.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 hostapd/ctrl_iface.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index a73a1d5..e69feae 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1071,16 +1071,28 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd)
 static int hostapd_ctrl_iface_chan_switch(struct hostapd_data *hapd, char *pos)
 {
 #ifdef NEED_AP_MLME
-	struct csa_settings settings;
-	int ret = hostapd_parse_csa_settings(pos, &settings);
+	struct csa_settings settings_def;
+	struct csa_settings *settings;
+	int ret, i;
 
+	ret = hostapd_parse_csa_settings(pos, &settings_def);
 	if (ret)
 		return ret;
 
-	settings.hapd = hapd;
-	settings.priv = hapd->drv_priv;
+	settings = os_malloc(sizeof(*settings) * hapd->iface->num_bss);
+	if (settings == NULL)
+		return -ENOMEM;
 
-	return hostapd_switch_channel(&settings, 1);
+	for (i = 0; i < hapd->iface->num_bss; i++) {
+		memcpy(&settings[i], &settings_def, sizeof(settings_def));
+		settings[i].hapd = hapd->iface->bss[i];
+		settings[i].priv = hapd->iface->bss[i]->drv_priv;
+	}
+
+	ret = hostapd_switch_channel(settings, hapd->iface->num_bss);
+	os_free(settings);
+
+	return ret;
 #else /* NEED_AP_MLME */
 	return -1;
 #endif /* NEED_AP_MLME */
-- 
1.8.4.rc3



From michal.kazior  Mon Jan 20 22:57:27 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:27 +0100
Subject: [RFC 5/6] nl80211: add new nl80211 attributes
In-Reply-To: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
References: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390287448-7718-6-git-send-email-michal.kazior@tieto.com>

This commit is only for testing convienence.
hostap maintaner takes care of updating
nl80211_copy.h.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/nl80211_copy.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index 91054fd..cab5824 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -1883,6 +1883,13 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_QOS_MAP,
 
+	NL80211_ATTR_MAC_HINT,
+	NL80211_ATTR_WIPHY_FREQ_HINT,
+
+	NL80211_ATTR_MAX_AP_ASSOC_STA,
+
+	NL80211_ATTR_CH_SWITCH_IFACES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
-- 
1.8.4.rc3



From michal.kazior  Mon Jan 20 22:57:28 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 21 Jan 2014 07:57:28 +0100
Subject: [RFC 6/6] nl80211: implement multi-interface CSA
In-Reply-To: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
References: <1390287448-7718-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <1390287448-7718-7-git-send-email-michal.kazior@tieto.com>

This implements extended channel switch command
variant. The extension allows declaring an array
of per interface CSA requests. CSA can be
performed per-wiphy.

For single-interface CSA old command variant is
used so older kernels will still work with
single-interface uses.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/driver_nl80211.c | 152 ++++++++++++++++++++++++++++++-------------
 1 file changed, 106 insertions(+), 46 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 94c2164..de7604d 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11390,18 +11390,87 @@ nla_put_failure:
 }
 
 
+static int set_csa_settings(struct nl_msg *msg,
+			    struct csa_settings *settings)
+{
+	struct i802_bss *bss = settings->priv;
+	struct nlattr *beacon_csa;
+	int ret;
+
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
+	NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count);
+	ret = nl80211_put_freq_params(msg, &settings->freq_params);
+	if (ret)
+		return ret;
+
+	if (settings->block_tx)
+		NLA_PUT_FLAG(msg, NL80211_ATTR_CH_SWITCH_BLOCK_TX);
+
+	/* beacon_after params */
+	ret = set_beacon_data(msg, &settings->beacon_after);
+	if (ret)
+		return ret;
+
+	/* beacon_csa params */
+	beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES);
+	if (!beacon_csa)
+		return -ENOBUFS;
+
+	ret = set_beacon_data(msg, &settings->beacon_csa);
+	if (ret)
+		return ret;
+
+	NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_BEACON,
+		    settings->counter_offset_beacon);
+
+	if (settings->beacon_csa.probe_resp)
+		NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_PRESP,
+			    settings->counter_offset_presp);
+
+	nla_nest_end(msg, beacon_csa);
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+
+
+static int validate_csa_settings(struct csa_settings *settings,
+				 int num_settings)
+{
+	int i;
+
+	if (num_settings <= 0)
+		return -EINVAL;
+
+	for (i = 0; i < num_settings; i++) {
+		if (!settings->beacon_csa.tail ||
+		    ((settings->beacon_csa.tail_len <=
+		      settings->counter_offset_beacon) ||
+		     (settings->beacon_csa.tail[settings->counter_offset_beacon] !=
+		      settings->cs_count)))
+			return -EINVAL;
+
+		if (settings->beacon_csa.probe_resp &&
+		    ((settings->beacon_csa.probe_resp_len <=
+		      settings->counter_offset_presp) ||
+		     (settings->beacon_csa.probe_resp[settings->counter_offset_presp] !=
+		      settings->cs_count)))
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
+
 static int nl80211_switch_channel(void *priv, struct csa_settings *settings,
 				  int num_settings)
 {
 	struct nl_msg *msg;
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
-	struct nlattr *beacon_csa;
-	int ret = -ENOBUFS;
-
-	/* multi-BSS not implemented yet */
-	if (num_settings != 1)
-		return -EOPNOTSUPP;
+	int i, ret = -ENOBUFS;
 
 	wpa_printf(MSG_DEBUG, "nl80211: Channel switch request (cs_count=%u block_tx=%u freq=%d width=%d cf1=%d cf2=%d)",
 		   settings->cs_count, settings->block_tx,
@@ -11418,62 +11487,53 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings,
 	    (drv->nlmode != NL80211_IFTYPE_P2P_GO))
 		return -EOPNOTSUPP;
 
-	/* check settings validity */
-	if (!settings->beacon_csa.tail ||
-	    ((settings->beacon_csa.tail_len <=
-	      settings->counter_offset_beacon) ||
-	     (settings->beacon_csa.tail[settings->counter_offset_beacon] !=
-	      settings->cs_count)))
-		return -EINVAL;
-
-	if (settings->beacon_csa.probe_resp &&
-	    ((settings->beacon_csa.probe_resp_len <=
-	      settings->counter_offset_presp) ||
-	     (settings->beacon_csa.probe_resp[settings->counter_offset_presp] !=
-	      settings->cs_count)))
-		return -EINVAL;
+	ret = validate_csa_settings(settings, num_settings);
+	if (ret)
+		return ret;
 
 	msg = nlmsg_alloc();
 	if (!msg)
 		return -ENOMEM;
 
 	nl80211_cmd(drv, msg, 0, NL80211_CMD_CHANNEL_SWITCH);
-	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
-	NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count);
-	ret = nl80211_put_freq_params(msg, &settings->freq_params);
-	if (ret)
-		goto error;
-
-	if (settings->block_tx)
-		NLA_PUT_FLAG(msg, NL80211_ATTR_CH_SWITCH_BLOCK_TX);
+	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, bss->wiphy_data->wiphy_idx);
+
+	if (num_settings == 1) {
+		/* use old command format for single interface to talk with
+		 * older kernels */
+		ret = set_csa_settings(msg, &settings[0]);
+		if (ret)
+			goto error;
+	}
+	else {
+		struct nlattr *ifaces;
+
+		/* newer kernel support multi-interface CSA with an extended
+		 * command structure */
+		ifaces = nla_nest_start(msg, NL80211_ATTR_CH_SWITCH_IFACES);
+		if (!ifaces)
+			goto nla_put_failure;
 
-	/* beacon_after params */
-	ret = set_beacon_data(msg, &settings->beacon_after);
-	if (ret)
-		goto error;
+		for (i = 0; i < num_settings; i++) {
+			struct nlattr *iface;
 
-	/* beacon_csa params */
-	beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES);
-	if (!beacon_csa)
-		goto nla_put_failure;
+			iface = nla_nest_start(msg, i + 1);
+			ret = set_csa_settings(msg, &settings[i]);
+			nla_nest_end(msg, iface);
 
-	ret = set_beacon_data(msg, &settings->beacon_csa);
-	if (ret)
-		goto error;
-
-	NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_BEACON,
-		    settings->counter_offset_beacon);
+			if (ret)
+				goto error;
+		}
 
-	if (settings->beacon_csa.probe_resp)
-		NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_PRESP,
-			    settings->counter_offset_presp);
+		nla_nest_end(msg, ifaces);
+	}
 
-	nla_nest_end(msg, beacon_csa);
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	if (ret) {
 		wpa_printf(MSG_DEBUG, "nl80211: switch_channel failed err=%d (%s)",
 			   ret, strerror(-ret));
 	}
+
 	return ret;
 
 nla_put_failure:
-- 
1.8.4.rc3



From j  Tue Jan 21 07:42:09 2014
From: j (Jouni Malinen)
Date: Tue, 21 Jan 2014 17:42:09 +0200
Subject: [PATCH] P2P: Reduce peer expiration age to 60 sec and allow
	customization
In-Reply-To: <20140117192209.83D5413FF44@ushik.mtv.corp.google.com>
References: <20140117192209.83D5413FF44@ushik.mtv.corp.google.com>
Message-ID: <20140121154209.GA15230@w1.fi>

On Fri, Jan 17, 2014 at 10:58:50AM -0800, Dmitry Shmidt wrote:
> -#define P2P_PEER_EXPIRATION_AGE 300
> +#ifndef P2P_PEER_EXPIRATION_AGE
> +#define P2P_PEER_EXPIRATION_AGE 60
> +#endif

Thanks, applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Tue Jan 21 07:42:29 2014
From: j (Jouni Malinen)
Date: Tue, 21 Jan 2014 17:42:29 +0200
Subject: [PATCH 1/3] supplicant: fix usage based on build options
In-Reply-To: <1390258995.8044.1.camel@dcbw.local>
References: <1390258995.8044.1.camel@dcbw.local>
Message-ID: <20140121154229.GB15230@w1.fi>

Thanks, applied all three.

-- 
Jouni Malinen                                            PGP id EFC895FA


From mvoteiza  Tue Jan 21 12:46:00 2014
From: mvoteiza (Mark Oteiza)
Date: Tue, 21 Jan 2014 15:46:00 -0500
Subject: [PATCH] wpa_supplicant: systemd service directives
Message-ID: <8761pdkqrb.fsf@holos.localdomain>


From: Mark Oteiza <mvoteiza at udel.edu>

Quoting 399ec170: "Use correct (multi-user) target when installing
systemd units [...] all services should always be installed in
multi-user.target"

These directives (Alias, WantedBy) are documented in systemd.unit(5)

Signed-hostap: Mark Oteiza <mvoteiza at udel.edu>
---
 wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in | 2 +-
 wpa_supplicant/systemd/wpa_supplicant-wired.service.arg.in   | 2 +-
 wpa_supplicant/systemd/wpa_supplicant.service.arg.in         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in b/wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in
index bfdee25..48e381b 100644
--- a/wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in
+++ b/wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in
@@ -10,4 +10,4 @@ Type=simple
 ExecStart=@BINDIR@/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-nl80211-%I.conf -Dnl80211 -i%I
 
 [Install]
-Alias=multi-user.target.wants/wpa_supplicant-nl80211@%i.service
+WantedBy=multi-user.target
diff --git a/wpa_supplicant/systemd/wpa_supplicant-wired.service.arg.in b/wpa_supplicant/systemd/wpa_supplicant-wired.service.arg.in
index 20ba0ad..b7876bd 100644
--- a/wpa_supplicant/systemd/wpa_supplicant-wired.service.arg.in
+++ b/wpa_supplicant/systemd/wpa_supplicant-wired.service.arg.in
@@ -10,4 +10,4 @@ Type=simple
 ExecStart=@BINDIR@/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-wired-%I.conf -Dwired -i%I
 
 [Install]
-Alias=multi-user.target.wants/wpa_supplicant-wired@%i.service
+WantedBy=multi-user.target
diff --git a/wpa_supplicant/systemd/wpa_supplicant.service.arg.in b/wpa_supplicant/systemd/wpa_supplicant.service.arg.in
index 10e62bc..b54ce8d 100644
--- a/wpa_supplicant/systemd/wpa_supplicant.service.arg.in
+++ b/wpa_supplicant/systemd/wpa_supplicant.service.arg.in
@@ -10,4 +10,4 @@ Type=simple
 ExecStart=@BINDIR@/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -i%I
 
 [Install]
-Alias=multi-user.target.wants/wpa_supplicant@%i.service
+WantedBy=multi-user.target
-- 
1.8.5.3




From ilan.peer  Wed Jan 22 06:05:44 2014
From: ilan.peer (Ilan Peer)
Date: Wed, 22 Jan 2014 16:05:44 +0200
Subject: [PATCH 1/4] wpa_supplicant: clone dtim period to a new interface
Message-ID: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>

From: David Spinadel <david.spinadel at intel.com>

Cloning dtim_period is needed for GO.

Signed-hostap: David Spinadel <david.spinadel at intel.com>
---
 wpa_supplicant/p2p_supplicant.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 5ef7614..889a949 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -1342,6 +1342,7 @@ static void wpas_p2p_clone_config(struct wpa_supplicant *dst,
 	d->pbc_in_m1 = s->pbc_in_m1;
 	d->ignore_old_scan_res = s->ignore_old_scan_res;
 	d->beacon_int = s->beacon_int;
+	d->dtim_period = s->dtim_period;
 	d->disassoc_low_ack = s->disassoc_low_ack;
 	d->disable_scan_offload = s->disable_scan_offload;
 }
-- 
1.7.10.4



From ilan.peer  Wed Jan 22 06:05:45 2014
From: ilan.peer (Ilan Peer)
Date: Wed, 22 Jan 2014 16:05:45 +0200
Subject: [PATCH 2/4] wpa_supplicant: fix of seg fault
	inwpas_ctrl_radio_work_flush
In-Reply-To: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
References: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1390399547-18835-2-git-send-email-ilan.peer@intel.com>

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

Added verification of wpa_s->radio pointer.

The segmentation fault details:

Program received signal SIGSEGV, Segmentation fault.
0x00000000004b9591 in wpas_ctrl_radio_work_flush (wpa_s=0x77fff0) at ctrl_iface.c:5754
5754		dl_list_for_each_safe(work, tmp, &wpa_s->radio->work,

Call stack:
0  wpas_ctrl_radio_work_flush (wpa_s=0x77fff0) at ctrl_iface.c:5754
1  wpa_supplicant_deinit_iface (wpa_s=0x77fff0, notify=0, terminate=0) at wpa_supplicant.c:3619
2  wpa_supplicant_add_iface (global=0x75db10, iface=0x7fffffffe270) at wpa_supplicant.c:3691
3  wpas_p2p_add_p2pdev_interface (wpa_s=0x75dd20) at p2p_supplicant.c:3700
4  main (argc=<optimized out>, argv=<optimized out>) at main.c:317

Function:
5750	void wpas_ctrl_radio_work_flush(struct wpa_supplicant *wpa_s)
5751	{
5752		struct wpa_radio_work *work, *tmp;
5753
5754		dl_list_for_each_safe(work, tmp, &wpa_s->radio->work,
5755				      struct wpa_radio_work, list) {
5756			struct wpa_external_work *ework;
5757
5758			if (os_strncmp(work->type, "ext:", 4) != 0)

Root cause:
(gdb) p wpa_s->radio
$1 = (struct wpa_radio *) 0x0

Signed-hostap: Max Stepanov <Max.Stepanov at intel.com>
---
 wpa_supplicant/ctrl_iface.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index f7ee6e3..ec79de3 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -5477,6 +5477,9 @@ void wpas_ctrl_radio_work_flush(struct wpa_supplicant *wpa_s)
 {
 	struct wpa_radio_work *work, *tmp;
 
+	if (!wpa_s || !wpa_s->radio)
+		return;
+
 	dl_list_for_each_safe(work, tmp, &wpa_s->radio->work,
 			      struct wpa_radio_work, list) {
 		struct wpa_external_work *ework;
-- 
1.7.10.4



From ilan.peer  Wed Jan 22 06:05:46 2014
From: ilan.peer (Ilan Peer)
Date: Wed, 22 Jan 2014 16:05:46 +0200
Subject: [PATCH 3/4] hostapd: fix segmentation fault when calling hostapd_cli
	all_sta
In-Reply-To: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
References: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1390399547-18835-3-git-send-email-ilan.peer@intel.com>

While iterating over the stations hostapd_ctrl_iface_sta_mib()
might be called with sta == NULL. Fix this.

Signed-hostap: Ilan Peer <ilan.peer at intel.com>
---
 src/ap/ctrl_iface_ap.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 3fb9e04..8c0cbab 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -86,6 +86,9 @@ static int hostapd_ctrl_iface_sta_mib(struct hostapd_data *hapd,
 {
 	int len, res, ret, i;
 
+	if (!sta)
+		return 0;
+
 	len = 0;
 	ret = os_snprintf(buf + len, buflen - len, MACSTR "\nflags=",
 			  MAC2STR(sta->addr));
@@ -203,7 +206,11 @@ int hostapd_ctrl_iface_sta_next(struct hostapd_data *hapd, const char *txtaddr,
 		if (ret < 0 || (size_t) ret >= buflen)
 			return 0;
 		return ret;
-	}		
+	}
+
+	if (!sta->next)
+		return 0;
+
 	return hostapd_ctrl_iface_sta_mib(hapd, sta->next, buf, buflen);
 }
 
-- 
1.7.10.4



From ilan.peer  Wed Jan 22 06:05:47 2014
From: ilan.peer (Ilan Peer)
Date: Wed, 22 Jan 2014 16:05:47 +0200
Subject: [PATCH 4/4] nl80211: fix of sizeof in vendor event handling
In-Reply-To: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
References: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1390399547-18835-4-git-send-email-ilan.peer@intel.com>

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

Fixing sizeof in a validity comparison of nl80211_vendor_cmd_info size.

Signed-hostap: Max Stepanov <Max.Stepanov at intel.com>
---
 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 0b8eed5..e648486 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -3584,7 +3584,7 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 
 		nla_for_each_nested(nl, tb[NL80211_ATTR_VENDOR_DATA], rem) {
 			struct nl80211_vendor_cmd_info *vinfo;
-			if (nla_len(nl) != sizeof(vinfo)) {
+			if (nla_len(nl) != sizeof(*vinfo)) {
 				wpa_printf(MSG_DEBUG, "nl80211: Unexpected vendor data info");
 				continue;
 			}
@@ -3600,7 +3600,7 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 
 		nla_for_each_nested(nl, tb[NL80211_ATTR_VENDOR_EVENTS], rem) {
 			struct nl80211_vendor_cmd_info *vinfo;
-			if (nla_len(nl) != sizeof(vinfo)) {
+			if (nla_len(nl) != sizeof(*vinfo)) {
 				wpa_printf(MSG_DEBUG, "nl80211: Unexpected vendor data info");
 				continue;
 			}
-- 
1.7.10.4



From johannes  Wed Jan 22 06:15:48 2014
From: johannes (Johannes Berg)
Date: Wed, 22 Jan 2014 15:15:48 +0100
Subject: [PATCH 4/4] nl80211: fix of sizeof in vendor event handling
In-Reply-To: <1390399547-18835-4-git-send-email-ilan.peer@intel.com>
References: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
	<1390399547-18835-4-git-send-email-ilan.peer@intel.com>
Message-ID: <1390400148.4334.31.camel@jlt4.sipsolutions.net>

On Wed, 2014-01-22 at 16:05 +0200, Ilan Peer wrote:
> From: Max Stepanov <Max.Stepanov at intel.com>
> 
> Fixing sizeof in a validity comparison of nl80211_vendor_cmd_info size.

>  			struct nl80211_vendor_cmd_info *vinfo;
> -			if (nla_len(nl) != sizeof(vinfo)) {
> +			if (nla_len(nl) != sizeof(*vinfo)) {

Funny, I guess this worked on 64-bit because the struct is 8 bytes
long ...

johannes



From j  Wed Jan 22 09:19:39 2014
From: j (Jouni Malinen)
Date: Wed, 22 Jan 2014 19:19:39 +0200
Subject: [PATCH 4/4] nl80211: fix of sizeof in vendor event handling
In-Reply-To: <1390400148.4334.31.camel@jlt4.sipsolutions.net>
References: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
	<1390399547-18835-4-git-send-email-ilan.peer@intel.com>
	<1390400148.4334.31.camel@jlt4.sipsolutions.net>
Message-ID: <20140122171939.GA10114@w1.fi>

On Wed, Jan 22, 2014 at 03:15:48PM +0100, Johannes Berg wrote:
> On Wed, 2014-01-22 at 16:05 +0200, Ilan Peer wrote:
> >  			struct nl80211_vendor_cmd_info *vinfo;
> > -			if (nla_len(nl) != sizeof(vinfo)) {
> > +			if (nla_len(nl) != sizeof(*vinfo)) {
> 
> Funny, I guess this worked on 64-bit because the struct is 8 bytes
> long ...

Yeah.. I only tested this on 64-bit since there was no vendor extension
support in mac80211_hwsim in the kernel tree. My server setup is running
with 32-bit builds, but it won't catch manual test cases like this now.
I guess we could consider adding a vendor command into mac80211_hwsim to
enable validation of this functionality in general both in
wpa_supplicant and cfg80211.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Wed Jan 22 10:16:14 2014
From: j (Jouni Malinen)
Date: Wed, 22 Jan 2014 20:16:14 +0200
Subject: [PATCH 1/4] wpa_supplicant: clone dtim period to a new interface
In-Reply-To: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
References: <1390399547-18835-1-git-send-email-ilan.peer@intel.com>
Message-ID: <20140122181614.GA13355@w1.fi>

Thanks, all four patches applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From carlos.henriquez  Wed Jan 22 13:01:37 2014
From: carlos.henriquez (Carlos Henriquez)
Date: Wed, 22 Jan 2014 18:01:37 -0300
Subject: How to include a hostapd_cli command?
Message-ID: <CABQ3_qYL0da4eiaGQ=d=D2Mz7C7K1+MmsEQPdUDt-NKCkmLo=Q@mail.gmail.com>

I've added a new function in ctrl_iface.c and I want to parse some
parameters when interacting with hostapd_cli. How can I do that?
I've already played with the code hostapd_cli.c, and I see that the main
functions are wpa_ctrl_request, hostapd_cli_cmd_newcmd, wpa_ctrl_command. I
need to only play with hostapd_cli.c? or something else?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140122/947aa381/attachment.htm>


From jithu  Thu Jan 23 07:11:14 2014
From: jithu (Jithu Jance)
Date: Thu, 23 Jan 2014 20:41:14 +0530
Subject: [PATCH 1/1] P2P: Addressing few issues seen with Broadcast SD
Message-ID: <20140123151114.GA5455@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.

Please see whether the patch is fine.

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 johannes  Thu Jan 23 12:10:53 2014
From: johannes (Johannes Berg)
Date: Thu, 23 Jan 2014 21:10:53 +0100
Subject: [PATCH] hwsim tests: add magic function call to wpasupplicant wrapper
	class
Message-ID: <1390507853-21253-1-git-send-email-johannes@sipsolutions.net>

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

To make some code simpler, instead of having to wrap every single
wpa_supplicant control interface call, add some magic to the
class to allow calling anything by name. Allow passing arbitrary
arguments and keywords as well.

For example, this allows changing:
  dev[0].request("RADIO_WORK add test-work-b freq=2417")
to
  dev[0].radio_work("add", "test-work-b", freq=2417)

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/wpasupplicant.py | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 082704b..a2a13e2 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -16,6 +16,19 @@ import wpaspy
 logger = logging.getLogger()
 wpas_ctrl = '/var/run/wpa_supplicant'
 
+class _Request:
+    def __init__(self, request, name):
+        self._request = request
+        self._name = name
+    def __call__(self, *args, **kwargs):
+        args = list(args)
+        if args:
+            args = [str(a) for a in list(args)]
+        for n, v in kwargs.iteritems():
+            args.append('%s=%s' % (n, str(v)))
+        args = [self._name.upper()] + args
+        return self._request(' '.join(args))
+
 class WpaSupplicant:
     def __init__(self, ifname=None, global_iface=None):
         self.group_ifname = None
@@ -730,9 +743,6 @@ class WpaSupplicant:
         if ev is None:
             raise Exception("Association with the AP timed out")
 
-    def relog(self):
-        self.request("RELOG")
-
     def wait_completed(self, timeout=10):
         for i in range(0, timeout * 2):
             if self.get_status_field("wpa_state") == "COMPLETED":
@@ -769,3 +779,20 @@ class WpaSupplicant:
             vals['opportunistic'] = opportunistic
             return vals
         return None
+
+    # objects should always be nonzero
+    def __nonzero__(self):
+        return 1
+
+    def __getattr__(self, name):
+        return _Request(self.request, name)
+
+_real_methods = {}
+for _n in dir(WpaSupplicant):
+    _f = getattr(WpaSupplicant, _n)
+    if callable(_f):
+        _real_methods[_n] = _f
+def _ctrl__call__(self, attr):
+    if attr in _real_methods:
+        return _real_methods[attr]
+WpaSupplicant.__call__ = _ctrl__call__
-- 
1.8.5.2



From johannes  Thu Jan 23 12:19:18 2014
From: johannes (Johannes Berg)
Date: Thu, 23 Jan 2014 21:19:18 +0100
Subject: [PATCH] hwsim tests: add magic function call to wpasupplicant wrapper
	class
Message-ID: <1390508358-21420-1-git-send-email-johannes@sipsolutions.net>

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

To make some code simpler, instead of having to wrap every single
wpa_supplicant control interface call, add some magic to the
class to allow calling anything by name. Allow passing arbitrary
arguments and keywords as well.

For example, this allows changing:
  dev[0].request("RADIO_WORK add test-work-b freq=2417")
to
  dev[0].radio_work.add("test-work-b", freq=2417)

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/wpasupplicant.py | 35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 082704b..ba9c3ff 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -16,6 +16,21 @@ import wpaspy
 logger = logging.getLogger()
 wpas_ctrl = '/var/run/wpa_supplicant'
 
+class _Request:
+    def __init__(self, request, name):
+        self._request = request
+        self._name = name
+    def __getattr__(self, name):
+        return _Request(self._request, "%s %s" % (self._name, name))
+    def __call__(self, *args, **kwargs):
+        args = list(args)
+        if args:
+            args = [str(a) for a in list(args)]
+        for n, v in kwargs.iteritems():
+            args.append('%s=%s' % (n, str(v)))
+        args = [self._name] + args
+        return self._request(' '.join(args))
+
 class WpaSupplicant:
     def __init__(self, ifname=None, global_iface=None):
         self.group_ifname = None
@@ -730,9 +745,6 @@ class WpaSupplicant:
         if ev is None:
             raise Exception("Association with the AP timed out")
 
-    def relog(self):
-        self.request("RELOG")
-
     def wait_completed(self, timeout=10):
         for i in range(0, timeout * 2):
             if self.get_status_field("wpa_state") == "COMPLETED":
@@ -769,3 +781,20 @@ class WpaSupplicant:
             vals['opportunistic'] = opportunistic
             return vals
         return None
+
+    # objects should always be nonzero
+    def __nonzero__(self):
+        return 1
+
+    def __getattr__(self, name):
+        return _Request(self.request, name.upper())
+
+_real_methods = {}
+for _n in dir(WpaSupplicant):
+    _f = getattr(WpaSupplicant, _n)
+    if callable(_f):
+        _real_methods[_n] = _f
+def _ctrl__call__(self, attr):
+    if attr in _real_methods:
+        return _real_methods[attr]
+WpaSupplicant.__call__ = _ctrl__call__
-- 
1.8.5.2



From johannes  Thu Jan 23 12:25:24 2014
From: johannes (Johannes Berg)
Date: Thu, 23 Jan 2014 21:25:24 +0100
Subject: [PATCH] hwsim tests: convert radio work test to new notation
Message-ID: <1390508724-21571-1-git-send-email-johannes@sipsolutions.net>

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

Convert the radio work test to the new notation that
the previous "python magic" patch made possible.

This is mostly intended as an example. We can convert
more if you want, but there's a tradeoff between the
'nice' python syntax and the 'raw' control interface
strings. It was just an idea I had.

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/test_radio_work.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/hwsim/test_radio_work.py b/tests/hwsim/test_radio_work.py
index 7f4f5c7..9baccee 100644
--- a/tests/hwsim/test_radio_work.py
+++ b/tests/hwsim/test_radio_work.py
@@ -15,13 +15,13 @@ import hostapd
 
 def test_ext_radio_work(dev, apdev):
     """External radio work item"""
-    id = dev[0].request("RADIO_WORK add test-work-a")
+    id = dev[0].radio_work.add("test-work-a")
     if "FAIL" in id:
         raise Exception("Failed to add radio work")
-    id2 = dev[0].request("RADIO_WORK add test-work-b freq=2417")
+    id2 = dev[0].radio_work.add("test-work-b", freq=2417)
     if "FAIL" in id2:
         raise Exception("Failed to add radio work")
-    id3 = dev[0].request("RADIO_WORK add test-work-c")
+    id3 = dev[0].radio_work.add("test-work-c")
     if "FAIL" in id3:
         raise Exception("Failed to add radio work")
 
@@ -31,7 +31,7 @@ def test_ext_radio_work(dev, apdev):
     if "EXT-RADIO-WORK-START " + id not in ev:
         raise Exception("Unexpected radio work start id")
 
-    items = dev[0].request("RADIO_WORK show")
+    items = dev[0].radio_work.show()
     if "ext:test-work-a at wlan0:0:1:" not in items:
         logger.info("Pending radio work items:\n" + items)
         raise Exception("Radio work item(a) missing from the list")
@@ -42,16 +42,16 @@ def test_ext_radio_work(dev, apdev):
         logger.info("Pending radio work items:\n" + items)
         raise Exception("Radio work item(c) missing from the list")
 
-    dev[0].request("RADIO_WORK done " + id2)
-    dev[0].request("RADIO_WORK done " + id)
+    dev[0].radio_work.done(id2)
+    dev[0].radio_work.done(id)
 
     ev = dev[0].wait_event(["EXT-RADIO-WORK-START"])
     if ev is None:
         raise Exception("Timeout while waiting radio work to start")
     if "EXT-RADIO-WORK-START " + id3 not in ev:
         raise Exception("Unexpected radio work start id")
-    dev[0].request("RADIO_WORK done " + id3)
-    items = dev[0].request("RADIO_WORK show")
+    dev[0].radio_work.done(id3)
+    items = dev[0].radio_work.show()
     if "ext:" in items:
         logger.info("Pending radio work items:\n" + items)
         raise Exception("Unexpected remaining radio work item")
-- 
1.8.5.2



From carlos.henriquez  Thu Jan 23 12:50:28 2014
From: carlos.henriquez (Carlos Henriquez)
Date: Thu, 23 Jan 2014 17:50:28 -0300
Subject: Undefined reference to "hostapd_get_aid"
Message-ID: <CABQ3_qaQ61Uk0w2O+T1fUc32vmC15RwLXd1Axg-NV6f8aZvxRA@mail.gmail.com>

Hi. I added hostapd_get_aid  function in "ctrl_iface.c" but in the moment
of compiling and linking using "make"  I got l_iface.c:304: undefined
reference to `hostapd_get_aid'

How can I solve that? hostapd_get_aid belong to ieee802_11.c but
ctrl_iface.c already included the ieee802_11.h header.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140123/21e6102d/attachment.htm>


From johannes  Fri Jan 24 04:32:27 2014
From: johannes (Johannes Berg)
Date: Fri, 24 Jan 2014 13:32:27 +0100
Subject: [PATCH] driver_nl80211: treat RSSI as part of each sched scan matchset
Message-ID: <1390566747-11598-1-git-send-email-johannes@sipsolutions.net>

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

The original RSSI filter semantics for scheduled scan were
really confusing - a separate matchset was created, but it
wasn't actually treated as a separate matchset in the kernel
but rather used as the global RSSI value. The RSSI matchset
thus behaved like an RSSI filter outside of the matchsets,
being ANDed rather than ORed (as normal between matchsets.)

To make this less confusing, I changed the kernel API a bit
to actually treat the RSSI inside each matchset properly,
but keeping it compatible with the old approach by using a
matchset with only an RSSI value as the default for all the
other matchsets, and adding it as a separate matchset only
if it's the only one.

The proper way for wpa_supplicant to do this then would be
to add the RSSI to each SSID matchset, and only add another
matchset without SSID if there's none with.

However, to keep compatibility with older kernels, always
keep the non-SSID matchset and only add the RSSI to all the
other matchsets. This gets close to the desired behaviour,
the only difference would be that we shouldn't add the RSSI
matchset if there are others, but stays compatible with old
and new kernels, as new ones ignore the RSSI-only matchset
if there are others and those others have an RSSI.

While at it, remove a useless cast and fix indentation.

Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
 src/drivers/driver_nl80211.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index b5bf368..1773a29 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4873,7 +4873,7 @@ static int wpa_driver_nl80211_sched_scan(void *priv,
 	NLA_PUT_U32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, interval);
 
 	if ((drv->num_filter_ssids &&
-	    (int) drv->num_filter_ssids <= drv->capa.max_match_sets) ||
+	     drv->num_filter_ssids <= drv->capa.max_match_sets) ||
 	    params->filter_rssi) {
 		struct nlattr *match_sets;
 		match_sets = nla_nest_start(msg, NL80211_ATTR_SCHED_SCAN_MATCH);
@@ -4893,10 +4893,20 @@ static int wpa_driver_nl80211_sched_scan(void *priv,
 			NLA_PUT(msg, NL80211_ATTR_SCHED_SCAN_MATCH_SSID,
 				drv->filter_ssids[i].ssid_len,
 				drv->filter_ssids[i].ssid);
+			if (params->filter_rssi)
+				NLA_PUT_U32(msg,
+					    NL80211_SCHED_SCAN_MATCH_ATTR_RSSI,
+					    params->filter_rssi);
 
 			nla_nest_end(msg, match_set_ssid);
 		}
 
+		/*
+		 * Due to backward compatibility code, newer kernels treat this
+		 * matchset (with only an RSSI filter) as the default for all
+		 * other matchsets, unless it's the only one, in which case the
+		 * matchset will actually allow all SSIDs above the RSSI.
+		 */
 		if (params->filter_rssi) {
 			struct nlattr *match_set_rssi;
 			match_set_rssi = nla_nest_start(msg, 0);
-- 
1.8.5.2



From misch  Fri Jan 24 04:31:53 2014
From: misch (Michael Schaller)
Date: Fri, 24 Jan 2014 13:31:53 +0100
Subject: Have there been any changes with the bug tracker or is it down?
Message-ID: <CALt099J9kXBm-j79SHjKwuARAZ9aYz5i3fid+Ovxcd1_3yP0aw@mail.gmail.com>

Hi everyone,

Have there been any changes with the bug tracker or is it down?
Previous links - like http://w1.fi/bugz/show_bug.cgi?id=499 - don't work
anymore.

Best,

Michael Schaller
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140124/78db2a53/attachment.htm>


From janusz.dziedzic  Fri Jan 24 14:12:23 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Fri, 24 Jan 2014 23:12:23 +0100
Subject: [PATCH 1/2] nl80211: print dfs region info
Message-ID: <1390601544-2866-1-git-send-email-janusz.dziedzic@tieto.com>

Print dfs region info when print
regulatory information.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/drivers/driver_nl80211.c |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6c4c816..79254b5 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6415,6 +6415,21 @@ static void nl80211_reg_rule_vht(struct nlattr *tb[],
 	}
 }
 
+static const char *dfs_domain_name(enum nl80211_dfs_regions region)
+{
+	switch (region) {
+	case NL80211_DFS_UNSET:
+		return "DFS-UNSET";
+	case NL80211_DFS_FCC:
+		return "DFS-FCC";
+	case NL80211_DFS_ETSI:
+		return "DFS-ETSI";
+	case NL80211_DFS_JP:
+		return "DFS-JP";
+	default:
+		return "DFS-invalid";
+	}
+}
 
 static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 {
@@ -6424,6 +6439,7 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 	struct nlattr *nl_rule;
 	struct nlattr *tb_rule[NL80211_FREQUENCY_ATTR_MAX + 1];
 	int rem_rule;
+	enum nl80211_dfs_regions dfs_domain;
 	static struct nla_policy reg_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
 		[NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 },
 		[NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 },
@@ -6442,8 +6458,14 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 		return NL_SKIP;
 	}
 
-	wpa_printf(MSG_DEBUG, "nl80211: Regulatory information - country=%s",
-		   (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]));
+	if (tb_msg[NL80211_ATTR_DFS_REGION])
+		dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
+	else
+		dfs_domain = NL80211_DFS_UNSET;
+
+	wpa_printf(MSG_DEBUG, "nl80211: Regulatory information - country=%s : %s",
+		   (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]),
+		   dfs_domain_name(dfs_domain));
 
 	nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule)
 	{
-- 
1.7.9.5



From janusz.dziedzic  Fri Jan 24 14:12:24 2014
From: janusz.dziedzic (Janusz Dziedzic)
Date: Fri, 24 Jan 2014 23:12:24 +0100
Subject: [PATCH 2/2] hostapd: set 5 sec timeout for channel list update
In-Reply-To: <1390601544-2866-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1390601544-2866-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <1390601544-2866-2-git-send-email-janusz.dziedzic@tieto.com>

Before this patch we have 1 second timeout for
regulatory update. In some cases, specially when
we reload driver modules on some slower platforms
this could take more than 1 second (about 2 second).
This is important specially for DFS case, where we
have to have correct dfs region before we will start
CAC. In other case (unknown DFS region) CAC will fail.
5 seconds should be enough for all cases.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/ap/hostapd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 44d05c5..48f1c55 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1028,7 +1028,7 @@ static int setup_interface(struct hostapd_iface *iface)
 		if (os_strncmp(previous_country, country, 2) != 0) {
 			wpa_printf(MSG_DEBUG, "Continue interface setup after channel list update");
 			iface->wait_channel_update = 1;
-			eloop_register_timeout(1, 0,
+			eloop_register_timeout(5, 0,
 					       channel_list_update_timeout,
 					       iface, NULL);
 			return 0;
-- 
1.7.9.5



From samiran.linux  Sun Jan 26 22:58:59 2014
From: samiran.linux (samiran saha)
Date: Mon, 27 Jan 2014 12:28:59 +0530
Subject: EAP-AKA server client implementation using hostapd as library
Message-ID: <CAOdN5SBVeMmH-CWKXn7Ua-Kjw1CRFNiAxyOVg_QjYeqdjTabXw@mail.gmail.com>

Hi,
   I am trying to modify the eap_example provided in hostap to implement
EAP-AKA server client program. But I am facing problems to do it. It would
be really helpful if anyone give the eap_example code for EAP-AKA .
Probably I am missing some eap_ctx inititilization and db_init.

Regards,
Samiran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140127/e593aed0/attachment.htm>


From chrisjanusz007  Mon Jan 27 17:57:01 2014
From: chrisjanusz007 (chris janusz)
Date: Mon, 27 Jan 2014 17:57:01 -0800
Subject: WPA-PSK for hostapd not working
Message-ID: <CA+1EjiQvrZ6ZUSHeW5tuY-tPYUY9NnHMRzmu4+oMCZ-UapnSRQ@mail.gmail.com>

Hi all:
  I have my AP configured using Athero AR6003 chip, and hostapd 1.0, the AP
works fine without Authentication. The WEP mode works, but when i tried to
turn on WPA-PSK, it failed with incorrect password.

Here is my hostapd.conf

interface=wlan0
driver=nl80211
ssid=mdm9x15
channel=1

#WEP WPA and WPA2
auth_algs=3
eapol_key_index_workaround=0
eap_server=0
wpa=3
wpa_passphrase=windowsxp
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
#rsn_pairwise=CCMP
macaddr_acl=0
ieee80211n=1
ieee8021x=0
wme_enabled=0

#log
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2

start hostapd with "/usr/sbin/hostapd /etc/hostapd.conf -dd", the log from
starting the daemon, associating with one client, and failed is in the
bottome of the email. occasionally i see these when starting the hostapd:

random: Cannot read from /dev/random: Resource temporarily unavailable
random: Got 0/4 bytes from /dev/random
random: Only 16/20 bytes of strong random data available from /dev/random
random: Not enough entropy pool available for secure operations
WPA: Not enough entropy in random pool to proceed - reject first 4-way
handshake

But even above message didn't appear, it still failed "PTKSTART: Retry
limit 4 reached"

Any idea on what caused this?

Appreciate any help!

------ --- the log is too big to post, here is the relevant log, i think it
indicates the error--------------

i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
unavailable)
WPA: Use EAPOL-Key timeout of 100 ms (retry counter 1)
wlan0: STA a4:4e:31:1a:1e:f8 WPA: EAPOL-Key timeout
WPA: a4:4e:31:1a:1e:f8 WPA_PTK entering state PTKSTART
wlan0: STA a4:4e:31:1a:1e:f8 WPA: sending 1/4 msg of 4-Way Handshake
WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8
kde_len=0 keyidx=0 encr=0)
nl80211: No monitor socket available for wpa_driver_nl80211_send_frame
i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
unavailable)
WPA: Use EAPOL-Key timeout of 1000 ms (retry counter 2)
wlan0: STA a4:4e:31:1a:1e:f8 WPA: EAPOL-Key timeout
WPA: a4:4e:31:1a:1e:f8 WPA_PTK entering state PTKSTART
wlan0: STA a4:4e:31:1a:1e:f8 WPA: sending 1/4 msg of 4-Way Handshake
WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8
kde_len=0 keyidx=0 encr=0)
nl80211: No monitor socket available for wpa_driver_nl80211_send_frame
i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
unavailable)
WPA: Use EAPOL-Key timeout of 1000 ms (retry counter 3)
wlan0: STA a4:4e:31:1a:1e:f8 WPA: EAPOL-Key timeout
WPA: a4:4e:31:1a:1e:f8 WPA_PTK entering state PTKSTART
wlan0: STA a4:4e:31:1a:1e:f8 WPA: sending 1/4 msg of 4-Way Handshake
WPA: Send EAPOL(version=2 secure=0 mic=0 ack=1 install=0 pairwise=8
kde_len=0 keyidx=0 encr=0)
nl80211: No monitor socket available for wpa_driver_nl80211_send_frame
i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
unavailable)
WPA: Use EAPOL-Key timeout of 1000 ms (retry counter 4)
wlan0: STA a4:4e:31:1a:1e:f8 WPA: EAPOL-Key timeout
WPA: a4:4e:31:1a:1e:f8 WPA_PTK entering state PTKSTART
wlan0: STA a4:4e:31:1a:1e:f8 WPA: PTKSTART: Retry limit 4 reached
WPA: a4:4e:31:1a:1e:f8 WPA_PTK entering state DISCONNECT
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140127/0af57c9e/attachment.htm>


From shital1391  Mon Jan 27 21:04:27 2014
From: shital1391 (shital jaju)
Date: Tue, 28 Jan 2014 10:34:27 +0530
Subject: [PATCH 1/1] checking for attr ifidx in survey handler
Message-ID: <CAFA2y8U16EpF+twKMDL-TtCpAJh6UFKqM8R=Zb-Nt7Gn1nS0UA@mail.gmail.com>

---
 src/drivers/driver_nl80211.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index b5bf368..1d3c663 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10552,7 +10552,10 @@ static int survey_handler(struct nl_msg *msg, void
*arg)
        nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
                  genlmsg_attrlen(gnlh, 0), NULL);

-       ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
+       if (tb[NL80211_ATTR_IFINDEX])
+               ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
+       else
+               return NL_SKIP;

        if (!tb[NL80211_ATTR_SURVEY_INFO])
                return NL_SKIP;
--
1.7.9.5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140128/721b9353/attachment.htm>


From shital1391  Mon Jan 27 21:44:57 2014
From: shital1391 (shital jaju)
Date: Tue, 28 Jan 2014 11:14:57 +0530
Subject: [PATCH 1/1] NL80211: checking for ifidx in survey handler
Message-ID: <CAFA2y8XTa=Dv=vz-r7P4zx3RbdEwM2Tbhq2K=65gruG9UXQHAw@mail.gmail.com>

This checks if attribute ifidx is present,
before trying to get the value of interface index.

Signed-hostap: Shital Jaju <shitalj at broadcom.com>
---
 src/drivers/driver_nl80211.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index b5bf368..1d3c663 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -10552,7 +10552,10 @@ static int survey_handler(struct nl_msg *msg, void
*arg)
        nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
                  genlmsg_attrlen(gnlh, 0), NULL);

-       ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
+       if (tb[NL80211_ATTR_IFINDEX])
+               ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
+       else
+               return NL_SKIP;

        if (!tb[NL80211_ATTR_SURVEY_INFO])
                return NL_SKIP;
--
1.7.9.5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140128/f9d23ac4/attachment.htm>


From ilan.peer  Mon Jan 27 23:32:34 2014
From: ilan.peer (Ilan Peer)
Date: Tue, 28 Jan 2014 09:32:34 +0200
Subject: [PATCH 1/2] wpa_supplicant: fix wrong size memory allocation
Message-ID: <1390894355-10876-1-git-send-email-ilan.peer@intel.com>

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

Fix memory allocation in wpa_scan_clone_params(), where the
allocation request used the size of a pointer rather than the
size of the structure.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 wpa_supplicant/scan.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 30da097..18d243e 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -1765,12 +1765,13 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src)
 	}
 
 	if (src->filter_ssids) {
-		params->filter_ssids = os_malloc(sizeof(params->filter_ssids) *
+		params->filter_ssids = os_malloc(sizeof(*params->filter_ssids) *
 						 src->num_filter_ssids);
 		if (params->filter_ssids == NULL)
 			goto failed;
 		os_memcpy(params->filter_ssids, src->filter_ssids,
-			  sizeof(params->filter_ssids) * src->num_filter_ssids);
+			  sizeof(*params->filter_ssids) *
+			  src->num_filter_ssids);
 		params->num_filter_ssids = src->num_filter_ssids;
 	}
 
-- 
1.7.10.4



From ilan.peer  Mon Jan 27 23:32:35 2014
From: ilan.peer (Ilan Peer)
Date: Tue, 28 Jan 2014 09:32:35 +0200
Subject: [PATCH 2/2] wpa_supplicant: fix memory leaks and wrong memory access
In-Reply-To: <1390894355-10876-1-git-send-email-ilan.peer@intel.com>
References: <1390894355-10876-1-git-send-email-ilan.peer@intel.com>
Message-ID: <1390894355-10876-2-git-send-email-ilan.peer@intel.com>

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

1. In wpa_config_process_bgscan() fix memory leak after
   calling wpa_config_parse_string()
2. In hostapd_config_defaults(), on failure to allocate bss->radius,
   conf->bss was not freed.
3. In p2p_deauth_nofif(), memory allocated in p2p_parse_ies() was not
   freed in case of NULL minor_reason_code.
4. In p2p_disassoc_nofif(), memory allocated in p2p_parse_ies() was not
   freed in case of NULL minor_reason_code.
5. In p2p_process_go_neg_conf(), memory allocated was not freed in case
   that the P2P Device interface was no waiting for a GoN confirm.
6. In wpa_set_pkcs11_engine_and_module_path(), the wrong pointer was checked.

Signed-hostap: Eytan Lifshitz <eytan.lifshitz at intel.com>
---
 src/ap/ap_config.c              |    1 +
 src/p2p/p2p.c                   |    8 ++++++--
 src/p2p/p2p_go_neg.c            |    1 +
 wpa_supplicant/config.c         |    5 ++++-
 wpa_supplicant/wpa_supplicant.c |    2 +-
 5 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 79ab4ba..368b202 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -140,6 +140,7 @@ struct hostapd_config * hostapd_config_defaults(void)
 
 	bss->radius = os_zalloc(sizeof(*bss->radius));
 	if (bss->radius == NULL) {
+		os_free(conf->bss);
 		os_free(conf);
 		os_free(bss);
 		return NULL;
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index ca347e7..957dee5 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -3862,8 +3862,10 @@ void p2p_deauth_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
 	os_memset(&msg, 0, sizeof(msg));
 	if (p2p_parse_ies(ie, ie_len, &msg))
 		return;
-	if (msg.minor_reason_code == NULL)
+	if (msg.minor_reason_code == NULL) {
+		p2p_parse_free(&msg);
 		return;
+	}
 
 	p2p_dbg(p2p, "Deauthentication notification BSSID " MACSTR
 		" reason_code=%u minor_reason_code=%u",
@@ -3884,8 +3886,10 @@ void p2p_disassoc_notif(struct p2p_data *p2p, const u8 *bssid, u16 reason_code,
 	os_memset(&msg, 0, sizeof(msg));
 	if (p2p_parse_ies(ie, ie_len, &msg))
 		return;
-	if (msg.minor_reason_code == NULL)
+	if (msg.minor_reason_code == NULL) {
+		p2p_parse_free(&msg);
 		return;
+	}
 
 	p2p_dbg(p2p, "Disassociation notification BSSID " MACSTR
 		" reason_code=%u minor_reason_code=%u",
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
index 76436f5..e28f93e 100644
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -1136,6 +1136,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
 
 	if (!(dev->flags & P2P_DEV_WAIT_GO_NEG_CONFIRM)) {
 		p2p_dbg(p2p, "Was not expecting GO Negotiation Confirm - ignore");
+		p2p_parse_free(&msg);
 		return;
 	}
 	dev->flags &= ~P2P_DEV_WAIT_GO_NEG_CONFIRM;
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index b43a72a..2dd7054 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2912,6 +2912,7 @@ static int wpa_config_process_bgscan(const struct global_parse_data *data,
 {
 	size_t len;
 	char *tmp;
+	int res;
 
 	tmp = wpa_config_parse_string(pos, &len);
 	if (tmp == NULL) {
@@ -2920,7 +2921,9 @@ static int wpa_config_process_bgscan(const struct global_parse_data *data,
 		return -1;
 	}
 
-	return wpa_global_config_parse_str(data, config, line, tmp);
+	res = wpa_global_config_parse_str(data, config, line, tmp);
+	os_free(tmp);
+	return res;
 }
 
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 35f5693..455b158 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2083,7 +2083,7 @@ int wpas_set_pkcs11_engine_and_module_path(struct wpa_supplicant *wpa_s,
 	}
 	if (pkcs11_module_path != NULL) {
 		pkcs11_module_path_copy = os_strdup(pkcs11_module_path);
-		if (pkcs11_engine_path_copy == NULL) {
+		if (pkcs11_module_path_copy == NULL) {
 			os_free(pkcs11_engine_path_copy);
 			return -1;
 		}
-- 
1.7.10.4



From michal.kazior  Tue Jan 28 05:56:41 2014
From: michal.kazior (Michal Kazior)
Date: Tue, 28 Jan 2014 14:56:41 +0100
Subject: [PATCH] nl80211: fix channel switching with VHT80
Message-ID: <1390917401-7768-1-git-send-email-michal.kazior@tieto.com>

It is possible for channel switch notification to
be missing channel type attribute. This is true at
least for VHT80. This led to
iface->conf->secondary_channel being set to 0.
This in turn made subsequent DFS-triggered CSA to
fail due to invalid frequency parameters.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/driver_nl80211.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 646d3f8..f11f2f4 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1550,6 +1550,33 @@ static void mlme_event_disconnect(struct wpa_driver_nl80211_data *drv,
 }
 
 
+static int calculate_chan_offset(int width, int freq, int cf1, int cf2)
+{
+	int freq1 = 0;
+
+	switch (convert2width(width)) {
+	case CHAN_WIDTH_20_NOHT:
+	case CHAN_WIDTH_20:
+		return 0;
+	case CHAN_WIDTH_40:
+		freq1 = cf1 - 10;
+		break;
+	case CHAN_WIDTH_80:
+		freq1 = cf1 - 30;
+		break;
+	case CHAN_WIDTH_160:
+		freq1 = cf1 - 70;
+		break;
+	case CHAN_WIDTH_UNKNOWN:
+	case CHAN_WIDTH_80P80:
+		/* FIXME: implement this */
+		return 0;
+	}
+
+	return (abs(freq - freq1) / 20) % 2 == 0 ? 1 : -1;
+}
+
+
 static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
 				 struct nlattr *ifindex, struct nlattr *freq,
 				 struct nlattr *type, struct nlattr *bw,
@@ -1591,6 +1618,15 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
 			chan_offset = -1;
 			break;
 		}
+	} else if (bw && cf1) {
+		/* This can happen for example with VHT80 ch switch */
+		chan_offset = calculate_chan_offset(nla_get_u32(bw),
+						    nla_get_u32(freq),
+						    nla_get_u32(cf1),
+						    cf2 ? nla_get_u32(cf2) : 0);
+	} else {
+		wpa_printf(MSG_WARNING, "nl80211: Unknown secondary channel information."
+			   " Future channel definition calculations will fail");
 	}
 
 	os_memset(&data, 0, sizeof(data));
-- 
1.8.5.3



From chrisjanusz007  Tue Jan 28 10:21:05 2014
From: chrisjanusz007 (chris janusz)
Date: Tue, 28 Jan 2014 10:21:05 -0800
Subject: Error when performing WPA authentication
Message-ID: <CA+1EjiS136ADeco0HCp2cOuea1mD46J7xdjwJgxfpJF-KfE3mQ@mail.gmail.com>

Hi all:
  I tried posting to the list, but my message is not showing up. Excuse me
if this is wrong list.  The question is about my hostapd failed for WPA
authentication.

Can anybody tell me what following messages indicates?

"i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
unavailable)"

Thanks

P.S: If this is not the right list, kindly please advise which list I
should post on.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140128/9e8f7da0/attachment.htm>


From baruch  Tue Jan 28 10:29:06 2014
From: baruch (Baruch Siach)
Date: Tue, 28 Jan 2014 20:29:06 +0200
Subject: Error when performing WPA authentication
In-Reply-To: <CA+1EjiS136ADeco0HCp2cOuea1mD46J7xdjwJgxfpJF-KfE3mQ@mail.gmail.com>
References: <CA+1EjiS136ADeco0HCp2cOuea1mD46J7xdjwJgxfpJF-KfE3mQ@mail.gmail.com>
Message-ID: <20140128182906.GC5596@tarshish>

Hi Chris,

On Tue, Jan 28, 2014 at 10:21:05AM -0800, chris janusz wrote:
> Hi all:
>   I tried posting to the list, but my message is not showing up. Excuse me
> if this is wrong list.  The question is about my hostapd failed for WPA
> authentication.

Your message appears in the list archive: 
http://article.gmane.org/gmane.linux.drivers.hostap/29506 .

> Can anybody tell me what following messages indicates?
> 
> "i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
> unavailable)"
> 
> Thanks
> 
> P.S: If this is not the right list, kindly please advise which list I
> should post on.

This is the right list.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -


From chrisjanusz007  Tue Jan 28 11:31:49 2014
From: chrisjanusz007 (chris janusz)
Date: Tue, 28 Jan 2014 11:31:49 -0800
Subject: Error when performing WPA authentication
In-Reply-To: <20140128182906.GC5596@tarshish>
References: <CA+1EjiS136ADeco0HCp2cOuea1mD46J7xdjwJgxfpJF-KfE3mQ@mail.gmail.com>
	<20140128182906.GC5596@tarshish>
Message-ID: <CA+1EjiSVft3hXo79kbnoj7VJGQ-P1D3p+kJc6p6oU9g=dbT6bg@mail.gmail.com>

HI Baruch:
  Thanks for the confirmation, i didn't receive the message i posted from
mailing list, so I thought it didn't go through.
  Anyway, Can anybody give me some hints on what may went wrong on the
problem i described?

Thanks
Lei


On Tue, Jan 28, 2014 at 10:29 AM, Baruch Siach <baruch at tkos.co.il> wrote:

> Hi Chris,
>
> On Tue, Jan 28, 2014 at 10:21:05AM -0800, chris janusz wrote:
> > Hi all:
> >   I tried posting to the list, but my message is not showing up. Excuse
> me
> > if this is wrong list.  The question is about my hostapd failed for WPA
> > authentication.
>
> Your message appears in the list archive:
> http://article.gmane.org/gmane.linux.drivers.hostap/29506 .
>
> > Can anybody tell me what following messages indicates?
> >
> > "i802_send_eapol - packet len: 131 - failed: 11 (Resource temporarily
> > unavailable)"
> >
> > Thanks
> >
> > P.S: If this is not the right list, kindly please advise which list I
> > should post on.
>
> This is the right list.
>
> baruch
>
> --
>      http://baruch.siach.name/blog/                  ~. .~   Tk Open
> Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
>    - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140128/ea7c75fe/attachment.htm>


From j  Thu Jan 30 03:35:20 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 13:35:20 +0200
Subject: [PATCH] wpa_supplicant: systemd service directives
In-Reply-To: <8761pdkqrb.fsf@holos.localdomain>
References: <8761pdkqrb.fsf@holos.localdomain>
Message-ID: <20140130113520.GA7542@w1.fi>

On Tue, Jan 21, 2014 at 03:46:00PM -0500, Mark Oteiza wrote:
> Quoting 399ec170: "Use correct (multi-user) target when installing
> systemd units [...] all services should always be installed in
> multi-user.target"
> 
> These directives (Alias, WantedBy) are documented in systemd.unit(5)

Could you please describe why this change is needed in the commit
message? The text here is just referring to some old commit without
giving any explanation why the additional change is needed. That
reference to systemd.unit(5) was not very helpful either for me:

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


> +++ b/wpa_supplicant/systemd/wpa_supplicant-nl80211.service.arg.in
> @@ -10,4 +10,4 @@ Type=simple
>  [Install]
> -Alias=multi-user.target.wants/wpa_supplicant-nl80211@%i.service
> +WantedBy=multi-user.target

So what does this do and why is it needed?

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 03:43:00 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 13:43:00 +0200
Subject: [PATCH 1/1] NL80211: checking for ifidx in survey handler
In-Reply-To: <CAFA2y8XTa=Dv=vz-r7P4zx3RbdEwM2Tbhq2K=65gruG9UXQHAw@mail.gmail.com>
References: <CAFA2y8XTa=Dv=vz-r7P4zx3RbdEwM2Tbhq2K=65gruG9UXQHAw@mail.gmail.com>
Message-ID: <20140130114300.GB7542@w1.fi>

On Tue, Jan 28, 2014 at 11:14:57AM +0530, shital jaju wrote:
> This checks if attribute ifidx is present,
> before trying to get the value of interface index.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -10552,7 +10552,10 @@ static int survey_handler(struct nl_msg *msg, void
> *arg)
> -       ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
> +       if (tb[NL80211_ATTR_IFINDEX])
> +               ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
> +       else
> +               return NL_SKIP;
>         if (!tb[NL80211_ATTR_SURVEY_INFO])
>                 return NL_SKIP;

While this would obviously do no harm and would be safe to apply, I
would like to understand why this would be needed. Is there a kernel
version somewhere that does not include NL80211_ATTR_IFINDEX in the
survey data? As far as I can see, cfg80211 adds it unconditionally to
all survey results. I think I'll apply this anyway since
driver_nl80211.c tries to follow the policy of validating all messages
from the kernel.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 03:52:32 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 13:52:32 +0200
Subject: [PATCH] driver_nl80211: treat RSSI as part of each sched scan
	matchset
In-Reply-To: <1390566747-11598-1-git-send-email-johannes@sipsolutions.net>
References: <1390566747-11598-1-git-send-email-johannes@sipsolutions.net>
Message-ID: <20140130115232.GA8695@w1.fi>

On Fri, Jan 24, 2014 at 01:32:27PM +0100, Johannes Berg wrote:
> While at it, remove a useless cast and fix indentation.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -4873,7 +4873,7 @@ static int wpa_driver_nl80211_sched_scan(void *priv,
>  	NLA_PUT_U32(msg, NL80211_ATTR_SCHED_SCAN_INTERVAL, interval);
>  
>  	if ((drv->num_filter_ssids &&
> -	    (int) drv->num_filter_ssids <= drv->capa.max_match_sets) ||
> +	     drv->num_filter_ssids <= drv->capa.max_match_sets) ||
>  	    params->filter_rssi) {

That's not a useless cast:

../src/drivers/driver_nl80211.c: In function ?wpa_driver_nl80211_sched_scan?:
../src/drivers/driver_nl80211.c:4979:29: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

I'm dropping this part. If you want to get this cleaned up, I could
consider a patch that does this and makes max_match_sets unsigned.. :)

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 05:06:05 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 15:06:05 +0200
Subject: [PATCH 1/1] P2P: Addressing few issues seen with Broadcast SD
In-Reply-To: <20140123151114.GA5455@jithu@broadcom.com>
References: <20140123151114.GA5455@jithu@broadcom.com>
Message-ID: <20140130130605.GA12451@w1.fi>

On Thu, Jan 23, 2014 at 08:41:14PM +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.
> 
> Please see whether the patch is fine.

It looks like this breaks six out of the eight P2P SD regression test
cases:
http://buildbot.w1.fi/hwsim/results.php?run=1391084937

As such, I had to drop this for now. I have not yet looked at the
details, but it looks clear that some changes are needed to avoid these
regressions.

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 05:12:29 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 15:12:29 +0200
Subject: [PATCH] driver_nl80211: treat RSSI as part of each sched scan
	matchset
In-Reply-To: <1390566747-11598-1-git-send-email-johannes@sipsolutions.net>
References: <1390566747-11598-1-git-send-email-johannes@sipsolutions.net>
Message-ID: <20140130131229.GA12636@w1.fi>

On Fri, Jan 24, 2014 at 01:32:27PM +0100, Johannes Berg wrote:
> The original RSSI filter semantics for scheduled scan were
> really confusing - a separate matchset was created, but it
> wasn't actually treated as a separate matchset in the kernel
> but rather used as the global RSSI value. The RSSI matchset
> thus behaved like an RSSI filter outside of the matchsets,
> being ANDed rather than ORed (as normal between matchsets.)

Thanks, applied (with the separate typecast/cleanup change removed).

-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 05:13:21 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 15:13:21 +0200
Subject: [PATCH 1/2] nl80211: print dfs region info
In-Reply-To: <1390601544-2866-1-git-send-email-janusz.dziedzic@tieto.com>
References: <1390601544-2866-1-git-send-email-janusz.dziedzic@tieto.com>
Message-ID: <20140130131321.GB12636@w1.fi>

On Fri, Jan 24, 2014 at 11:12:23PM +0100, Janusz Dziedzic wrote:
> Print dfs region info when print
> regulatory information.

Thanks, both patches applied (with this 1/2 changed to not modify the
debug print text if cfg80211 does not include the new attribute).
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 05:13:41 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 15:13:41 +0200
Subject: [PATCH 1/2] wpa_supplicant: fix wrong size memory allocation
In-Reply-To: <1390894355-10876-1-git-send-email-ilan.peer@intel.com>
References: <1390894355-10876-1-git-send-email-ilan.peer@intel.com>
Message-ID: <20140130131341.GC12636@w1.fi>

On Tue, Jan 28, 2014 at 09:32:34AM +0200, Ilan Peer wrote:
> Fix memory allocation in wpa_scan_clone_params(), where the
> allocation request used the size of a pointer rather than the
> size of the structure.

Thanks, both patches applied.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 05:14:07 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 15:14:07 +0200
Subject: [PATCH] nl80211: fix channel switching with VHT80
In-Reply-To: <1390917401-7768-1-git-send-email-michal.kazior@tieto.com>
References: <1390917401-7768-1-git-send-email-michal.kazior@tieto.com>
Message-ID: <20140130131407.GD12636@w1.fi>

On Tue, Jan 28, 2014 at 02:56:41PM +0100, Michal Kazior wrote:
> It is possible for channel switch notification to
> be missing channel type attribute. This is true at
> least for VHT80. This led to
> iface->conf->secondary_channel being set to 0.
> This in turn made subsequent DFS-triggered CSA to
> fail due to invalid frequency parameters.

Thanks, applied.

-- 
Jouni Malinen                                            PGP id EFC895FA


From jithu  Thu Jan 30 05:36:41 2014
From: jithu (Jithu Jance)
Date: Thu, 30 Jan 2014 13:36:41 +0000
Subject: [PATCH 1/1] P2P: Addressing few issues seen with Broadcast SD
In-Reply-To: <20140130130605.GA12451@w1.fi>
References: <20140123151114.GA5455@jithu@broadcom.com>
	<20140130130605.GA12451@w1.fi>
Message-ID: <25A448014331D04F82E3035BCF9620AF2AF32578@SJEXCHMB09.corp.ad.broadcom.com>

Hi Jouni,

Thanks for the feedback. I will look at the failure cases.

Thanks,

Jithu


> -----Original Message-----
> From: Jouni Malinen [mailto:j at w1.fi]
> Sent: Thursday, January 30, 2014 6:36 PM
> To: Jithu Jance
> Cc: hostap at lists.shmoo.com
> Subject: Re: [PATCH 1/1] P2P: Addressing few issues seen with Broadcast SD
> 
> On Thu, Jan 23, 2014 at 08:41:14PM +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.
> >
> > Please see whether the patch is fine.
> 
> It looks like this breaks six out of the eight P2P SD regression test
> cases:
> http://buildbot.w1.fi/hwsim/results.php?run=1391084937
> 
> As such, I had to drop this for now. I have not yet looked at the
> details, but it looks clear that some changes are needed to avoid these
> regressions.
> 
> --
> Jouni Malinen                                            PGP id EFC895FA


From j  Thu Jan 30 05:38:59 2014
From: j (Jouni Malinen)
Date: Thu, 30 Jan 2014 15:38:59 +0200
Subject: Preparations for hostapd/wpa_supplicant v2.1
Message-ID: <20140130133859.GA13353@w1.fi>

This was supposed to happen quite some time ago, but due to various
reasons, things got pushed out number of times.. Anyway, I guess we
could try to get the next release finally out. With all the regression
tests now in place, it may not be necessary to lock the master branch
for couple of weeks anymore. Anyway, I think I'll take at least couple
of days or up to a week or so with only bug fixes allowed into the
master branch and all other changes going into the pending branch until
v2.1 is out.

-- 
Jouni Malinen                                            PGP id EFC895FA


From eduardo.abinader  Thu Jan 30 06:39:00 2014
From: eduardo.abinader (Eduardo Abinader)
Date: Thu, 30 Jan 2014 10:39:00 -0400
Subject: [PATCH 1/1] hwsim tests: adapt p2p_discovery to new notation
Message-ID: <1391092740-10858-1-git-send-email-eduardo.abinader@openbossa.org>

This patch removes "magic" ctrl_iface calls from test case,
thus, complying with he new notation.

Signed-hostap: Eduardo Abinader <eduardo.abinader at openbossa.org>
---
 tests/hwsim/test_p2p_discovery.py | 6 +++---
 tests/hwsim/wpasupplicant.py      | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/test_p2p_discovery.py b/tests/hwsim/test_p2p_discovery.py
index d555e02..1825c38 100644
--- a/tests/hwsim/test_p2p_discovery.py
+++ b/tests/hwsim/test_p2p_discovery.py
@@ -23,7 +23,7 @@ def test_discovery(dev):
         raise Exception("Device discovery timed out")
 
     logger.info("Test provision discovery for display")
-    dev[0].global_request("P2P_PROV_DISC " + addr1 + " display")
+    dev[0].p2p_prov_disc(addr1, "display")
     ev1 = dev[1].wait_global_event(["P2P-PROV-DISC-SHOW-PIN"], timeout=15)
     if ev1 is None:
         raise Exception("Provision discovery timed out (display/dev1)")
@@ -39,7 +39,7 @@ def test_discovery(dev):
         raise Exception("Dev1 not in provision discovery event")
 
     logger.info("Test provision discovery for keypad")
-    dev[0].global_request("P2P_PROV_DISC " + addr1 + " keypad")
+    dev[0].p2p_prov_disc(addr1, "keypad")
     ev1 = dev[1].wait_global_event(["P2P-PROV-DISC-ENTER-PIN"], timeout=15)
     if ev1 is None:
         raise Exception("Provision discovery timed out (keypad/dev1)")
@@ -56,7 +56,7 @@ def test_discovery(dev):
         raise Exception("Dev1 not in provision discovery event")
 
     logger.info("Test provision discovery for push button")
-    dev[0].global_request("P2P_PROV_DISC " + addr1 + " pbc")
+    dev[0].p2p_prov_disc(addr1, "pbc")
     ev1 = dev[1].wait_global_event(["P2P-PROV-DISC-PBC-REQ"], timeout=15)
     if ev1 is None:
         raise Exception("Provision discovery timed out (pbc/dev1)")
diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py
index 3707cbb..3d67861 100644
--- a/tests/hwsim/wpasupplicant.py
+++ b/tests/hwsim/wpasupplicant.py
@@ -297,6 +297,9 @@ class WpaSupplicant:
     def p2p_stop_find(self):
         return self.global_request("P2P_STOP_FIND")
 
+    def p2p_prov_disc(self, dev_addr, method):
+        return self.global_request("P2P_PROV_DISC " + dev_addr + " " + method)
+
     def wps_read_pin(self):
         #TODO: make this random
         self.pin = "12345670"
-- 
1.8.1.2



From dimitrysh  Wed Jan 29 13:49:43 2014
From: dimitrysh (Dmitry Shmidt)
Date: Wed, 29 Jan 2014 13:49:43 -0800
Subject: [PATCH] TLS: Add tls_options field per network to set addition TLS
	options
Message-ID: <20140130205619.06C5513FE69@ushik.mtv.corp.google.com>

Change-Id: I037dc8d7bdf54ef281e139bd778d8a3fc572d72c
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
 src/crypto/tls.h              |  1 +
 src/crypto/tls_openssl.c      | 19 +++++++++++++++++++
 src/eap_peer/eap_config.h     |  7 +++++++
 src/eap_peer/eap_tls_common.c |  1 +
 wpa_supplicant/config.c       |  1 +
 5 files changed, 29 insertions(+)

diff --git a/src/crypto/tls.h b/src/crypto/tls.h
index 287fd33..b85dfb1 100644
--- a/src/crypto/tls.h
+++ b/src/crypto/tls.h
@@ -163,6 +163,7 @@ struct tls_connection_params {
 
 	unsigned int flags;
 	const char *ocsp_stapling_response;
+	const char *tls_options;
 };
 
 
diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
index 4cfa5f4..5127e09 100644
--- a/src/crypto/tls_openssl.c
+++ b/src/crypto/tls_openssl.c
@@ -3117,11 +3117,26 @@ static int ocsp_status_cb(SSL *s, void *arg)
 #endif /* HAVE_OCSP */
 
 
+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;
+}
+
+
 int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
 			      const struct tls_connection_params *params)
 {
 	int ret;
 	unsigned long err;
+	long options;
 
 	if (conn == NULL)
 		return -1;
@@ -3192,6 +3207,10 @@ int tls_connection_set_params(void *tls_ctx, struct tls_connection *conn,
 #endif /* SSL_clear_options */
 #endif /*  SSL_OP_NO_TICKET */
 
+	options = tls_connection_get_opt(params);
+	if (options)
+		SSL_set_options(conn->ssl, options);
+
 #ifdef HAVE_OCSP
 	if (params->flags & TLS_CONN_REQUEST_OCSP) {
 		SSL_CTX *ssl_ctx = tls_ctx;
diff --git a/src/eap_peer/eap_config.h b/src/eap_peer/eap_config.h
index 98ec1f7..34470b5 100644
--- a/src/eap_peer/eap_config.h
+++ b/src/eap_peer/eap_config.h
@@ -678,6 +678,13 @@ struct eap_peer_config {
 	 * SIM/USIM processing.
 	 */
 	char *external_sim_resp;
+
+	/**
+	 * tls_options - Additional options for TLS connection
+	 *
+	 * This filed allows to set additional TLS options per network.
+	 */
+	char *tls_options;
 };
 
 
diff --git a/src/eap_peer/eap_tls_common.c b/src/eap_peer/eap_tls_common.c
index 008af37..54e8098 100644
--- a/src/eap_peer/eap_tls_common.c
+++ b/src/eap_peer/eap_tls_common.c
@@ -85,6 +85,7 @@ static void eap_tls_params_from_conf1(struct tls_connection_params *params,
 	params->key_id = config->key_id;
 	params->cert_id = config->cert_id;
 	params->ca_cert_id = config->ca_cert_id;
+	params->tls_options = config->tls_options;
 	eap_tls_params_flags(params, config->phase1);
 }
 
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index b43a72a..c604b07 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1652,6 +1652,7 @@ static const struct parse_data ssid_fields[] = {
 	{ INTe(engine) },
 	{ INTe(engine2) },
 	{ INT(eapol_flags) },
+	{ STRe(tls_options) },
 #endif /* IEEE8021X_EAPOL */
 	{ FUNC_KEY(wep_key0) },
 	{ FUNC_KEY(wep_key1) },
-- 
1.8.5.3



From masashi.honma  Thu Jan 30 19:32:47 2014
From: masashi.honma (Masashi Honma)
Date: Fri, 31 Jan 2014 12:32:47 +0900
Subject: [PATCH] BSD: Fix hostapd complier warning
Message-ID: <CAFk-A4m6ZA00y8uUBsixNmHL4RyoSMpyfiUCG16KHicgPhfB4A@mail.gmail.com>

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.

Signed-hostap: Masashi Honma <masashi.honma at gmail.com>

Regards,
Masashi Honma.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 3805 bytes
Desc: not available
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140131/bb2b5e46/attachment.obj>


From johannes  Fri Jan 31 05:55:17 2014
From: johannes (Johannes Berg)
Date: Fri, 31 Jan 2014 14:55:17 +0100
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <52D6C2DD.2090306@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>
Message-ID: <1391176517.4141.19.camel@jlt4.sipsolutions.net>

On Wed, 2014-01-15 at 09:18 -0800, Ben Greear wrote:

> > Now, I'm not necessarily saying this would be a bad thing, but as it
> > stands right now I'm not convinced that this can be done.
> 
> I'm not trying to force a driver to do anything, but I would definitely
> like to suggest a driver give the management packets high priority,
> and for drivers I can use and modify, I will try to make sure they work
> properly.  Other driver writers can do as they wish.

Sure, that's all well, I guess I'm just a bit worried that other drivers
might interpret those priority values of 256+ as different specials, and
the wrong thing would happen if this change was done generically in
wpa_s.

> If anyone can proclaim an API, then you can.  If you have another API in mind,
> please detail it.  If no one cares, then I can just carry the hostap patch in
> my own tree and move on to other things.

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.

johannes



From bartosz.markowski  Fri Jan 31 07:45:39 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 16:45:39 +0100
Subject: [PATCH 1/2] nl80211: allocate more memory for channel_switch cmd
In-Reply-To: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391183140-3437-2-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

Once a certain threshold was reached (depending on
number of IEs and BSSes) channel switch was
failing with -ENOBUFS meaning nlmsg was too small
to fit the whole command.

Pre-allocate a big buffer for channel switch to
avoid this. 64KiB seems reasonable from a
practical point of view as it should handle at
least 8 BSSes.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/driver_nl80211.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 81f20b3..77149ba 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11596,7 +11596,11 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 	      settings->cs_count)))
 		return -EINVAL;
 
-	msg = nlmsg_alloc();
+	/* each interface channel switch request can be sizable as it contains
+	 * a beacon and possibly a probe response. this size varies depending
+	 * on the number of IEs. pre-allocate memory for the nlmsg. this could
+	 * be probably caculated/estimated but 64KiB seems like a sane value */
+	msg = nlmsg_alloc_size(64 * 1024);
 	if (!msg)
 		return -ENOMEM;
 
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 07:45:38 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 16:45:38 +0100
Subject: [PATCH 0/2] nl80211: allocate more memory chan switch cmd
Message-ID: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com>

The problem has been found when testing the multi-interface CSA.

Sending it just as a heads up and for review (will be squashed
in next iteration  of 'multi-interface CSA' patchset.

Michal Kazior (2):
  nl80211: allocate more memory for channel_switch cmd
  nl80211: print channel switch error code

 src/drivers/driver_nl80211.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 07:45:40 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 16:45:40 +0100
Subject: [PATCH 2/2] nl80211: print channel switch error code
In-Reply-To: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391183140-3437-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391183140-3437-3-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

This makes it easier to understand why/how channel
switch command fails.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/driver_nl80211.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 77149ba..b82a13d 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11647,7 +11647,7 @@ nla_put_failure:
 	ret = -ENOBUFS;
 error:
 	nlmsg_free(msg);
-	wpa_printf(MSG_DEBUG, "nl80211: Could not build channel switch request");
+	wpa_printf(MSG_DEBUG, "nl80211: Could not build channel switch request err=%d", ret);
 	return ret;
 }
 
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:56:59 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:56:59 +0100
Subject: [RFC v2 1/6] hostapd: move CSA structures to hostapd_data
In-Reply-To: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391187424-5653-2-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

This prepares CSA structure and logic in hostapd
for multi-BSS support.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/ap/beacon.c              |   20 ++++++++++----------
 src/ap/dfs.c                 |   14 ++++++++++++--
 src/ap/drv_callbacks.c       |    6 ++++--
 src/ap/hostapd.c             |   40 ++++++++++++++++++++--------------------
 src/ap/hostapd.h             |   16 ++++++++--------
 src/drivers/driver_nl80211.c |    4 ++--
 6 files changed, 56 insertions(+), 44 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 5318ecb..e32d60f 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -200,18 +200,18 @@ static u8 * hostapd_eid_csa(struct hostapd_data *hapd, u8 *eid)
 {
 	u8 chan;
 
-	if (!hapd->iface->cs_freq_params.freq)
+	if (!hapd->cs_freq_params.freq)
 		return eid;
 
-	if (ieee80211_freq_to_chan(hapd->iface->cs_freq_params.freq, &chan) ==
+	if (ieee80211_freq_to_chan(hapd->cs_freq_params.freq, &chan) ==
 	    NUM_HOSTAPD_MODES)
 		return eid;
 
 	*eid++ = WLAN_EID_CHANNEL_SWITCH;
 	*eid++ = 3;
-	*eid++ = hapd->iface->cs_block_tx;
+	*eid++ = hapd->cs_block_tx;
 	*eid++ = chan;
-	*eid++ = hapd->iface->cs_count;
+	*eid++ = hapd->cs_count;
 
 	return eid;
 }
@@ -221,12 +221,12 @@ static u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid)
 {
 	u8 sec_ch;
 
-	if (!hapd->iface->cs_freq_params.sec_channel_offset)
+	if (!hapd->cs_freq_params.sec_channel_offset)
 		return eid;
 
-	if (hapd->iface->cs_freq_params.sec_channel_offset == -1)
+	if (hapd->cs_freq_params.sec_channel_offset == -1)
 		sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW;
-	else if (hapd->iface->cs_freq_params.sec_channel_offset == 1)
+	else if (hapd->cs_freq_params.sec_channel_offset == 1)
 		sec_ch = HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE;
 	else
 		return eid;
@@ -341,7 +341,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 	pos = hostapd_eid_roaming_consortium(hapd, pos);
 
 	pos = hostapd_add_csa_elems(hapd, pos, (u8 *)resp,
-				    &hapd->iface->cs_c_off_proberesp);
+				    &hapd->cs_c_off_proberesp);
 #ifdef CONFIG_IEEE80211AC
 	pos = hostapd_eid_vht_capabilities(hapd, pos);
 	pos = hostapd_eid_vht_operation(hapd, pos);
@@ -753,7 +753,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 	tailpos = hostapd_eid_adv_proto(hapd, tailpos);
 	tailpos = hostapd_eid_roaming_consortium(hapd, tailpos);
 	tailpos = hostapd_add_csa_elems(hapd, tailpos, tail,
-					&hapd->iface->cs_c_off_beacon);
+					&hapd->cs_c_off_beacon);
 #ifdef CONFIG_IEEE80211AC
 	tailpos = hostapd_eid_vht_capabilities(hapd, tailpos);
 	tailpos = hostapd_eid_vht_operation(hapd, tailpos);
@@ -878,7 +878,7 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
 	struct wpabuf *beacon, *proberesp, *assocresp;
 	int res, ret = -1;
 
-	if (hapd->iface->csa_in_progress) {
+	if (hapd->csa_in_progress) {
 		wpa_printf(MSG_ERROR, "Cannot set beacons during CSA period");
 		return -1;
 	}
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index e4c00f8..fe69333 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -671,6 +671,16 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface)
 }
 
 
+static int hostapd_csa_in_progress(struct hostapd_iface *iface)
+{
+	int i;
+	for (i = 0; i < iface->num_bss; i++)
+		if (iface->bss[0]->csa_in_progress)
+			return 1;
+	return 0;
+}
+
+
 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 {
 	struct hostapd_channel_data *channel;
@@ -684,10 +694,10 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 
 	wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)",
 		   __func__, iface->cac_started ? "yes" : "no",
-		   iface->csa_in_progress ? "yes" : "no");
+		   hostapd_csa_in_progress(iface) ? "yes" : "no");
 
 	/* Check if CSA in progress */
-	if (iface->csa_in_progress)
+	if (hostapd_csa_in_progress(iface))
 		return 0;
 
 	/* Check if active CAC */
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
index 9af9646..bca7d32 100644
--- a/src/ap/drv_callbacks.c
+++ b/src/ap/drv_callbacks.c
@@ -30,6 +30,7 @@
 #include "ap_config.h"
 #include "hw_features.h"
 #include "dfs.h"
+#include "beacon.h"
 
 
 int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
@@ -440,9 +441,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 	hapd->iconf->vht_oper_centr_freq_seg0_idx = seg0_idx;
 	hapd->iconf->vht_oper_centr_freq_seg1_idx = seg1_idx;
 
-	if (hapd->iface->csa_in_progress &&
-	    freq == hapd->iface->cs_freq_params.freq) {
+	if (hapd->csa_in_progress &&
+	    freq == hapd->cs_freq_params.freq) {
 		hostapd_cleanup_cs_params(hapd);
+		ieee802_11_set_beacon(hapd);
 
 		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_CSA_FINISHED "freq=%d",
 			freq);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index f9edf3b..3526049 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2045,13 +2045,12 @@ static void free_beacon_data(struct beacon_data *beacon)
 }
 
 
-static int hostapd_build_beacon_data(struct hostapd_iface *iface,
+static int hostapd_build_beacon_data(struct hostapd_data *hapd,
 				     struct beacon_data *beacon)
 {
 	struct wpabuf *beacon_extra, *proberesp_extra, *assocresp_extra;
 	struct wpa_driver_ap_params params;
 	int ret;
-	struct hostapd_data *hapd = iface->bss[0];
 
 	os_memset(beacon, 0, sizeof(*beacon));
 	ret = ieee802_11_build_ap_params(hapd, &params);
@@ -2175,14 +2174,15 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
+static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
 				     struct csa_settings *settings)
 {
+	struct hostapd_iface *iface = hapd->iface;
 	struct hostapd_freq_params old_freq;
 	int ret;
 
 	os_memset(&old_freq, 0, sizeof(old_freq));
-	if (!iface || !iface->freq || iface->csa_in_progress)
+	if (!iface || !iface->freq || hapd->csa_in_progress)
 		return -1;
 
 	ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
@@ -2191,7 +2191,7 @@ static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
 	if (ret)
 		return ret;
 
-	ret = hostapd_build_beacon_data(iface, &settings->beacon_after);
+	ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
 
 	/* change back the configuration */
 	hostapd_change_config_freq(iface->bss[0], iface->conf,
@@ -2201,18 +2201,18 @@ static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
 		return ret;
 
 	/* set channel switch parameters for csa ie */
-	iface->cs_freq_params = settings->freq_params;
-	iface->cs_count = settings->cs_count;
-	iface->cs_block_tx = settings->block_tx;
+	hapd->cs_freq_params = settings->freq_params;
+	hapd->cs_count = settings->cs_count;
+	hapd->cs_block_tx = settings->block_tx;
 
-	ret = hostapd_build_beacon_data(iface, &settings->beacon_csa);
+	ret = hostapd_build_beacon_data(hapd, &settings->beacon_csa);
 	if (ret) {
 		free_beacon_data(&settings->beacon_after);
 		return ret;
 	}
 
-	settings->counter_offset_beacon = iface->cs_c_off_beacon;
-	settings->counter_offset_presp = iface->cs_c_off_proberesp;
+	settings->counter_offset_beacon = hapd->cs_c_off_beacon;
+	settings->counter_offset_presp = hapd->cs_c_off_proberesp;
 
 	return 0;
 }
@@ -2220,13 +2220,13 @@ static int hostapd_fill_csa_settings(struct hostapd_iface *iface,
 
 void hostapd_cleanup_cs_params(struct hostapd_data *hapd)
 {
-	os_memset(&hapd->iface->cs_freq_params, 0,
-		  sizeof(hapd->iface->cs_freq_params));
-	hapd->iface->cs_count = 0;
-	hapd->iface->cs_block_tx = 0;
-	hapd->iface->cs_c_off_beacon = 0;
-	hapd->iface->cs_c_off_proberesp = 0;
-	hapd->iface->csa_in_progress = 0;
+	os_memset(&hapd->cs_freq_params, 0,
+		  sizeof(hapd->cs_freq_params));
+	hapd->cs_count = 0;
+	hapd->cs_block_tx = 0;
+	hapd->cs_c_off_beacon = 0;
+	hapd->cs_c_off_proberesp = 0;
+	hapd->csa_in_progress = 0;
 }
 
 
@@ -2234,7 +2234,7 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
 			   struct csa_settings *settings)
 {
 	int ret;
-	ret = hostapd_fill_csa_settings(hapd->iface, settings);
+	ret = hostapd_fill_csa_settings(hapd, settings);
 	if (ret)
 		return ret;
 
@@ -2248,7 +2248,7 @@ int hostapd_switch_channel(struct hostapd_data *hapd,
 		return ret;
 	}
 
-	hapd->iface->csa_in_progress = 1;
+	hapd->csa_in_progress = 1;
 	return 0;
 }
 
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 489ab16..993def0 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -213,6 +213,14 @@ struct hostapd_data {
 			   size_t psk_len);
 	void *new_psk_cb_ctx;
 
+	/* channel switch parameters */
+	struct hostapd_freq_params cs_freq_params;
+	u8 cs_count;
+	int cs_block_tx;
+	unsigned int cs_c_off_beacon;
+	unsigned int cs_c_off_proberesp;
+	int csa_in_progress;
+
 #ifdef CONFIG_P2P
 	struct p2p_data *p2p;
 	struct p2p_group *p2p_group;
@@ -337,14 +345,6 @@ struct hostapd_iface {
 	/* lowest observed noise floor in dBm */
 	s8 lowest_nf;
 
-	/* channel switch parameters */
-	struct hostapd_freq_params cs_freq_params;
-	u8 cs_count;
-	int cs_block_tx;
-	unsigned int cs_c_off_beacon;
-	unsigned int cs_c_off_proberesp;
-	int csa_in_progress;
-
 #ifdef CONFIG_ACS
 	unsigned int acs_num_completed_scans;
 #endif /* CONFIG_ACS */
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 81f20b3..5162ecd 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1641,7 +1641,7 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
 
 	bss->freq = data.ch_switch.freq;
 
-	wpa_supplicant_event(drv->ctx, EVENT_CH_SWITCH, &data);
+	wpa_supplicant_event(bss->ctx, EVENT_CH_SWITCH, &data);
 }
 
 
@@ -11601,7 +11601,7 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 		return -ENOMEM;
 
 	nl80211_cmd(drv, msg, 0, NL80211_CMD_CHANNEL_SWITCH);
-	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex);
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
 	NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count);
 	ret = nl80211_put_freq_params(msg, &settings->freq_params);
 	if (ret)
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:56:58 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:56:58 +0100
Subject: [RFC v2 0/6] hostapd: implement multi-interface CSA
Message-ID: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>

v2 (if someone wants to actually test it):
* rebase and align with recent changes for CSA
* fix wpa_supplicant compilation problem

This is the userspace part of my multi-interface
CSA patchset. I've already posted some kernel
related patches to the linux-wireless mailing
list.

I'm posting this as an RFC instead of a PATCH
since kernel changes are yet to be accepted &
merged.

Patch 5 is more of a convienence for testing and a
hint that nl80211 must be updated if the patchset
is applied at some later point in time.


Michal Kazior (6):
  hostapd: move CSA structures to hostapd_data
  hostapd: extend CSA driver API
  hostapd: use extended CSA interface for chan_switch cmd
  hostapd: submit multi-interface CSA requests for DFS
  nl80211: add new nl80211 attributes
  nl80211: implement multi-interface CSA

 hostapd/ctrl_iface.c         |   21 +++++-
 src/ap/ap_drv_ops.h          |   14 +++-
 src/ap/beacon.c              |   20 +++---
 src/ap/dfs.c                 |   97 +++++++++++++++++++-------
 src/ap/drv_callbacks.c       |    6 +-
 src/ap/hostapd.c             |   69 ++++++++++---------
 src/ap/hostapd.h             |   19 +++---
 src/drivers/driver.h         |   11 ++-
 src/drivers/driver_nl80211.c |  153 ++++++++++++++++++++++++++++++------------
 src/drivers/nl80211_copy.h   |    7 ++
 wpa_supplicant/ap.c          |    5 +-
 wpa_supplicant/driver_i.h    |    2 +-
 12 files changed, 294 insertions(+), 130 deletions(-)

-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:57:01 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:57:01 +0100
Subject: [RFC v2 3/6] hostapd: use extended CSA interface for chan_switch cmd
In-Reply-To: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391187424-5653-4-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

By default if there are multiple interfaces
running try multi-interface CSA. This is most
likely what the user wants anyway.

Moving a single interface with nl80211 when others
are running wouldn't have worked anyway (assuming
kernel driver supports multi-channel) since
operating frequency is shared across interfaces in
nl80211 backend.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 hostapd/ctrl_iface.c |   22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index df5c513..eca184b 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1132,16 +1132,28 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd)
 static int hostapd_ctrl_iface_chan_switch(struct hostapd_data *hapd, char *pos)
 {
 #ifdef NEED_AP_MLME
-	struct csa_settings settings;
-	int ret = hostapd_parse_csa_settings(pos, &settings);
+	struct csa_settings settings_def;
+	struct csa_settings *settings;
+	int ret, i;
 
+	ret = hostapd_parse_csa_settings(pos, &settings_def);
 	if (ret)
 		return ret;
 
-	settings.hapd = hapd;
-	settings.priv = hapd->drv_priv;
+	settings = os_malloc(sizeof(*settings) * hapd->iface->num_bss);
+	if (settings == NULL)
+		return -ENOMEM;
 
-	return hostapd_switch_channel(&settings, 1);
+	for (i = 0; i < hapd->iface->num_bss; i++) {
+		memcpy(&settings[i], &settings_def, sizeof(settings_def));
+		settings[i].hapd = hapd->iface->bss[i];
+		settings[i].priv = hapd->iface->bss[i]->drv_priv;
+	}
+
+	ret = hostapd_switch_channel(settings, hapd->iface->num_bss);
+	os_free(settings);
+
+	return ret;
 #else /* NEED_AP_MLME */
 	return -1;
 #endif /* NEED_AP_MLME */
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:57:00 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:57:00 +0100
Subject: [RFC v2 2/6] hostapd: extend CSA driver API
In-Reply-To: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391187424-5653-3-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

This prepares CSA driver API to support multi-BSS.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 hostapd/ctrl_iface.c         |    5 ++++-
 src/ap/ap_drv_ops.h          |   14 +++++++++++---
 src/ap/dfs.c                 |    4 +++-
 src/ap/hostapd.c             |   35 ++++++++++++++++++++++-------------
 src/ap/hostapd.h             |    3 +--
 src/drivers/driver.h         |   11 +++++++++--
 src/drivers/driver_nl80211.c |    7 ++++++-
 wpa_supplicant/ap.c          |    5 ++++-
 wpa_supplicant/driver_i.h    |    2 +-
 9 files changed, 61 insertions(+), 25 deletions(-)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 4a9da5f..df5c513 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -1138,7 +1138,10 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_data *hapd, char *pos)
 	if (ret)
 		return ret;
 
-	return hostapd_switch_channel(hapd, &settings);
+	settings.hapd = hapd;
+	settings.priv = hapd->drv_priv;
+
+	return hostapd_switch_channel(&settings, 1);
 #else /* NEED_AP_MLME */
 	return -1;
 #endif /* NEED_AP_MLME */
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 15a4b26..a729d7c 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -263,13 +263,21 @@ static inline const char * hostapd_drv_get_radio_name(struct hostapd_data *hapd)
 	return hapd->driver->get_radio_name(hapd->drv_priv);
 }
 
-static inline int hostapd_drv_switch_channel(struct hostapd_data *hapd,
-					     struct csa_settings *settings)
+static inline int hostapd_drv_switch_channel(struct csa_settings *settings,
+					     int num_settings)
 {
+	struct hostapd_data *hapd;
+
+	if (num_settings < 1)
+		return -EINVAL;
+
+	hapd = settings[0].hapd;
+
 	if (hapd->driver == NULL || hapd->driver->switch_channel == NULL)
 		return -ENOTSUP;
 
-	return hapd->driver->switch_channel(hapd->drv_priv, settings);
+	return hapd->driver->switch_channel(hapd->drv_priv, settings,
+					    num_settings);
 }
 
 static inline int hostapd_drv_status(struct hostapd_data *hapd, char *buf,
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index fe69333..9e86925 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -724,6 +724,8 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 
 	/* Setup CSA request */
 	os_memset(&csa_settings, 0, sizeof(csa_settings));
+	csa_settings.hapd = hapd;
+	csa_settings.priv = hapd->drv_priv;
 	csa_settings.cs_count = 5;
 	csa_settings.block_tx = 1;
 	err = hostapd_set_freq_params(&csa_settings.freq_params,
@@ -744,7 +746,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 		return err;
 	}
 
-	err = hostapd_switch_channel(hapd, &csa_settings);
+	err = hostapd_switch_channel(&csa_settings, 1);
 	if (err) {
 		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback",
 			   err);
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 3526049..b1817a8 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2174,9 +2174,9 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
-				     struct csa_settings *settings)
+static int hostapd_fill_csa_settings(struct csa_settings *settings)
 {
+	struct hostapd_data *hapd = settings->hapd;
 	struct hostapd_iface *iface = hapd->iface;
 	struct hostapd_freq_params old_freq;
 	int ret;
@@ -2230,25 +2230,34 @@ void hostapd_cleanup_cs_params(struct hostapd_data *hapd)
 }
 
 
-int hostapd_switch_channel(struct hostapd_data *hapd,
-			   struct csa_settings *settings)
+int hostapd_switch_channel(struct csa_settings *settings,
+			   int num_settings)
 {
-	int ret;
-	ret = hostapd_fill_csa_settings(hapd, settings);
-	if (ret)
-		return ret;
+	int i, ret;
+
+	for (i = 0; i < num_settings; i++) {
+		ret = hostapd_fill_csa_settings(&settings[i]);
+		if (ret)
+			return ret;
+	}
 
-	ret = hostapd_drv_switch_channel(hapd, settings);
-	free_beacon_data(&settings->beacon_csa);
-	free_beacon_data(&settings->beacon_after);
+	ret = hostapd_drv_switch_channel(settings, num_settings);
+
+	for (i = 0; i < num_settings; i++) {
+		free_beacon_data(&settings[i].beacon_csa);
+		free_beacon_data(&settings[i].beacon_after);
+	}
 
 	if (ret) {
 		/* if we failed, clean cs parameters */
-		hostapd_cleanup_cs_params(hapd);
+		for (i = 0; i < num_settings; i++)
+			hostapd_cleanup_cs_params(settings[i].hapd);
 		return ret;
 	}
 
-	hapd->csa_in_progress = 1;
+	for (i = 0; i < num_settings; i++)
+		settings[i].hapd->csa_in_progress = 1;
+
 	return 0;
 }
 
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index 993def0..3510911 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -391,8 +391,7 @@ int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf);
 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator);
 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s);
 const char * hostapd_state_text(enum hostapd_iface_state s);
-int hostapd_switch_channel(struct hostapd_data *hapd,
-			   struct csa_settings *settings);
+int hostapd_switch_channel(struct csa_settings *settings, int num_settings);
 void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
 
 /* utils.c */
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 2f4536e..57bff4a 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1213,6 +1213,8 @@ struct beacon_data {
 
 /**
  * struct csa_settings - Settings for channel switch command
+ * @hapd: Pointer to hostapd context
+ * @priv: Pointer to driver-specific context.
  * @cs_count: Count in Beacon frames (TBTT) to perform the switch
  * @block_tx: 1 - block transmission for CSA period
  * @freq_params: Next channel frequency parameter
@@ -1222,6 +1224,9 @@ struct beacon_data {
  * @counter_offset_presp: Offset to the count field in probe resp.
  */
 struct csa_settings {
+	struct hostapd_data *hapd;
+	void *priv;
+
 	u8 cs_count;
 	u8 block_tx;
 
@@ -2622,13 +2627,15 @@ struct wpa_driver_ops {
 	 * switch_channel - Announce channel switch and migrate the GO to the
 	 * given frequency
 	 * @priv: Private driver interface data
-	 * @settings: Settings for CSA period and new channel
+	 * @settings: Settings for CSA period and new channel for multiple BSSes
+	 * @num_settings: Number of CSA settings for different BSSes
 	 * Returns: 0 on success, -1 on failure
 	 *
 	 * This function is used to move the GO to the legacy STA channel to
 	 * avoid frequency conflict in single channel concurrency.
 	 */
-	int (*switch_channel)(void *priv, struct csa_settings *settings);
+	int (*switch_channel)(void *priv, struct csa_settings *settings,
+			      int num_settings);
 
 	/**
 	 * start_dfs_cac - Listen for radar interference on the channel
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 5162ecd..f10bd1f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11558,7 +11558,8 @@ nla_put_failure:
 }
 
 
-static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
+static int nl80211_switch_channel(void *priv, struct csa_settings *settings,
+				  int num_settings)
 {
 	struct nl_msg *msg;
 	struct i802_bss *bss = priv;
@@ -11566,6 +11567,10 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings)
 	struct nlattr *beacon_csa;
 	int ret = -ENOBUFS;
 
+	/* multi-BSS not implemented yet */
+	if (num_settings != 1)
+		return -EOPNOTSUPP;
+
 	wpa_printf(MSG_DEBUG, "nl80211: Channel switch request (cs_count=%u block_tx=%u freq=%d width=%d cf1=%d cf2=%d)",
 		   settings->cs_count, settings->block_tx,
 		   settings->freq_params.freq, settings->freq_params.bandwidth,
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index ce3efcb..ba21f18 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -1094,7 +1094,10 @@ int ap_switch_channel(struct wpa_supplicant *wpa_s,
 	if (!wpa_s->ap_iface || !wpa_s->ap_iface->bss[0])
 		return -1;
 
-	return hostapd_switch_channel(wpa_s->ap_iface->bss[0], settings);
+	settings->hapd = wpa_s->ap_iface->bss[0];
+	settings->priv = wpa_s->ap_iface->bss[0]->drv_priv;
+
+	return hostapd_switch_channel(settings, 1);
 #else /* NEED_AP_MLME */
 	return -1;
 #endif /* NEED_AP_MLME */
diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h
index 0691b6c..c2a16fd 100644
--- a/wpa_supplicant/driver_i.h
+++ b/wpa_supplicant/driver_i.h
@@ -574,7 +574,7 @@ static inline int wpa_drv_switch_channel(struct wpa_supplicant *wpa_s,
 {
 	if (!wpa_s->driver->switch_channel)
 		return -1;
-	return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings);
+	return wpa_s->driver->switch_channel(wpa_s->drv_priv, settings, 1);
 }
 
 static inline int wpa_drv_wnm_oper(struct wpa_supplicant *wpa_s,
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:57:02 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:57:02 +0100
Subject: [RFC v2 4/6] hostapd: submit multi-interface CSA requests for DFS
In-Reply-To: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391187424-5653-5-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

When a radar is detecteed all BSSes sharing a
channel should switch. Switching a single
interface when multiple interfaces are running
wouldn't have worked with todays drivers anyway.

This also changes behaviour when CSA param setup
fails. Instead of disabling the hostapd_iface
fallback is tried (i.e. disable -> enable).

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/ap/dfs.c |   85 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 61 insertions(+), 24 deletions(-)

diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 9e86925..d3d7356 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -681,6 +681,56 @@ static int hostapd_csa_in_progress(struct hostapd_iface *iface)
 }
 
 
+static struct csa_settings *
+hostapd_dfs_get_csa_settings(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)
+{
+	struct csa_settings *csa_settings;
+	int err, i;
+
+	csa_settings = os_malloc(sizeof(*csa_settings) * iface->num_bss);
+	if (!csa_settings)
+		return NULL;
+
+	memset(csa_settings, 0, sizeof(*csa_settings) * iface->num_bss);
+
+	for (i = 0; i < iface->num_bss; i++) {
+		struct hostapd_data *hapd = iface->bss[i];
+
+		csa_settings[i].hapd = hapd;
+		csa_settings[i].priv = hapd->drv_priv;
+		csa_settings[i].block_tx = 1;
+
+		/* FIXME: compute this depending on regulatory domain and
+		 * beacon interval to match regulatory quiescing requirements
+		 */
+		csa_settings[i].cs_count = 5;
+
+		err = hostapd_set_freq_params(&csa_settings[i].freq_params,
+					      iface->conf->hw_mode,
+					      channel->freq,
+					      channel->chan,
+					      hapd->iconf->ieee80211n,
+					      hapd->iconf->ieee80211ac,
+					      secondary_channel,
+					      hapd->iconf->vht_oper_chwidth,
+					      vht_oper_centr_freq_seg0_idx,
+					      vht_oper_centr_freq_seg1_idx,
+					      iface->current_mode->vht_capab);
+		if (err) {
+			wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
+			os_free(csa_settings);
+			return NULL;
+		}
+	}
+
+	return csa_settings;
+}
+
+
 static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 {
 	struct hostapd_channel_data *channel;
@@ -688,8 +738,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 	u8 vht_oper_centr_freq_seg0_idx;
 	u8 vht_oper_centr_freq_seg1_idx;
 	int skip_radar = 1;
-	struct csa_settings csa_settings;
-	struct hostapd_data *hapd = iface->bss[0];
+	struct csa_settings *csa_settings;
 	int err = 1;
 
 	wpa_printf(MSG_DEBUG, "%s called (CAC active: %s, CSA active: %s)",
@@ -723,30 +772,18 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface)
 		channel->chan, secondary_channel);
 
 	/* Setup CSA request */
-	os_memset(&csa_settings, 0, sizeof(csa_settings));
-	csa_settings.hapd = hapd;
-	csa_settings.priv = hapd->drv_priv;
-	csa_settings.cs_count = 5;
-	csa_settings.block_tx = 1;
-	err = hostapd_set_freq_params(&csa_settings.freq_params,
-				      iface->conf->hw_mode,
-				      channel->freq,
-				      channel->chan,
-				      iface->conf->ieee80211n,
-				      iface->conf->ieee80211ac,
-				      secondary_channel,
-				      iface->conf->vht_oper_chwidth,
-				      vht_oper_centr_freq_seg0_idx,
-				      vht_oper_centr_freq_seg1_idx,
-				      iface->current_mode->vht_capab);
-
-	if (err) {
-		wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
-		hostapd_disable_iface(iface);
-		return err;
+	csa_settings = hostapd_dfs_get_csa_settings(iface, channel,
+						    secondary_channel,
+						    vht_oper_centr_freq_seg0_idx,
+						    vht_oper_centr_freq_seg1_idx);
+
+	if (csa_settings) {
+		err = hostapd_switch_channel(csa_settings, iface->num_bss);
+		os_free(csa_settings);
+	} else {
+		err = -1; /* just try fallback */
 	}
 
-	err = hostapd_switch_channel(&csa_settings, 1);
 	if (err) {
 		wpa_printf(MSG_WARNING, "DFS failed to schedule CSA (%d) - trying fallback",
 			   err);
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:57:03 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:57:03 +0100
Subject: [RFC v2 5/6] nl80211: add new nl80211 attributes
In-Reply-To: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391187424-5653-6-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

This commit is only for testing convienence.
hostap maintaner takes care of updating
nl80211_copy.h.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/nl80211_copy.h |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/drivers/nl80211_copy.h b/src/drivers/nl80211_copy.h
index 91054fd..cab5824 100644
--- a/src/drivers/nl80211_copy.h
+++ b/src/drivers/nl80211_copy.h
@@ -1883,6 +1883,13 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_QOS_MAP,
 
+	NL80211_ATTR_MAC_HINT,
+	NL80211_ATTR_WIPHY_FREQ_HINT,
+
+	NL80211_ATTR_MAX_AP_ASSOC_STA,
+
+	NL80211_ATTR_CH_SWITCH_IFACES,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
-- 
1.7.9.5



From bartosz.markowski  Fri Jan 31 08:57:04 2014
From: bartosz.markowski (Bartosz Markowski)
Date: Fri, 31 Jan 2014 17:57:04 +0100
Subject: [RFC v2 6/6] nl80211: implement multi-interface CSA
In-Reply-To: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
References: <1391187424-5653-1-git-send-email-bartosz.markowski@tieto.com>
Message-ID: <1391187424-5653-7-git-send-email-bartosz.markowski@tieto.com>

From: Michal Kazior <michal.kazior at tieto.com>

This implements extended channel switch command
variant. The extension allows declaring an array
of per interface CSA requests. CSA can be
performed per-wiphy.

For single-interface CSA old command variant is
used so older kernels will still work with
single-interface uses.

Signed-hostap: Michal Kazior <michal.kazior at tieto.com>
---
 src/drivers/driver_nl80211.c |  152 +++++++++++++++++++++++++++++-------------
 1 file changed, 106 insertions(+), 46 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index f10bd1f..abb08b9 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -11558,18 +11558,87 @@ nla_put_failure:
 }
 
 
+static int set_csa_settings(struct nl_msg *msg,
+			    struct csa_settings *settings)
+{
+	struct i802_bss *bss = settings->priv;
+	struct nlattr *beacon_csa;
+	int ret;
+
+	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
+	NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count);
+	ret = nl80211_put_freq_params(msg, &settings->freq_params);
+	if (ret)
+		return ret;
+
+	if (settings->block_tx)
+		NLA_PUT_FLAG(msg, NL80211_ATTR_CH_SWITCH_BLOCK_TX);
+
+	/* beacon_after params */
+	ret = set_beacon_data(msg, &settings->beacon_after);
+	if (ret)
+		return ret;
+
+	/* beacon_csa params */
+	beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES);
+	if (!beacon_csa)
+		return -ENOBUFS;
+
+	ret = set_beacon_data(msg, &settings->beacon_csa);
+	if (ret)
+		return ret;
+
+	NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_BEACON,
+		    settings->counter_offset_beacon);
+
+	if (settings->beacon_csa.probe_resp)
+		NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_PRESP,
+			    settings->counter_offset_presp);
+
+	nla_nest_end(msg, beacon_csa);
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+
+
+static int validate_csa_settings(struct csa_settings *settings,
+				 int num_settings)
+{
+	int i;
+
+	if (num_settings <= 0)
+		return -EINVAL;
+
+	for (i = 0; i < num_settings; i++) {
+		if (!settings->beacon_csa.tail ||
+		    ((settings->beacon_csa.tail_len <=
+		      settings->counter_offset_beacon) ||
+		     (settings->beacon_csa.tail[settings->counter_offset_beacon] !=
+		      settings->cs_count)))
+			return -EINVAL;
+
+		if (settings->beacon_csa.probe_resp &&
+		    ((settings->beacon_csa.probe_resp_len <=
+		      settings->counter_offset_presp) ||
+		     (settings->beacon_csa.probe_resp[settings->counter_offset_presp] !=
+		      settings->cs_count)))
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
+
 static int nl80211_switch_channel(void *priv, struct csa_settings *settings,
 				  int num_settings)
 {
 	struct nl_msg *msg;
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
-	struct nlattr *beacon_csa;
-	int ret = -ENOBUFS;
-
-	/* multi-BSS not implemented yet */
-	if (num_settings != 1)
-		return -EOPNOTSUPP;
+	int i, ret = -ENOBUFS;
 
 	wpa_printf(MSG_DEBUG, "nl80211: Channel switch request (cs_count=%u block_tx=%u freq=%d width=%d cf1=%d cf2=%d)",
 		   settings->cs_count, settings->block_tx,
@@ -11586,62 +11655,53 @@ static int nl80211_switch_channel(void *priv, struct csa_settings *settings,
 	    (drv->nlmode != NL80211_IFTYPE_P2P_GO))
 		return -EOPNOTSUPP;
 
-	/* check settings validity */
-	if (!settings->beacon_csa.tail ||
-	    ((settings->beacon_csa.tail_len <=
-	      settings->counter_offset_beacon) ||
-	     (settings->beacon_csa.tail[settings->counter_offset_beacon] !=
-	      settings->cs_count)))
-		return -EINVAL;
-
-	if (settings->beacon_csa.probe_resp &&
-	    ((settings->beacon_csa.probe_resp_len <=
-	      settings->counter_offset_presp) ||
-	     (settings->beacon_csa.probe_resp[settings->counter_offset_presp] !=
-	      settings->cs_count)))
-		return -EINVAL;
+	ret = validate_csa_settings(settings, num_settings);
+	if (ret)
+		return ret;
 
 	msg = nlmsg_alloc();
 	if (!msg)
 		return -ENOMEM;
 
 	nl80211_cmd(drv, msg, 0, NL80211_CMD_CHANNEL_SWITCH);
-	NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex);
-	NLA_PUT_U32(msg, NL80211_ATTR_CH_SWITCH_COUNT, settings->cs_count);
-	ret = nl80211_put_freq_params(msg, &settings->freq_params);
-	if (ret)
-		goto error;
-
-	if (settings->block_tx)
-		NLA_PUT_FLAG(msg, NL80211_ATTR_CH_SWITCH_BLOCK_TX);
+	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, bss->wiphy_data->wiphy_idx);
+
+	if (num_settings == 1) {
+		/* use old command format for single interface to talk with
+		 * older kernels */
+		ret = set_csa_settings(msg, &settings[0]);
+		if (ret)
+			goto error;
+	}
+	else {
+		struct nlattr *ifaces;
+
+		/* newer kernel support multi-interface CSA with an extended
+		 * command structure */
+		ifaces = nla_nest_start(msg, NL80211_ATTR_CH_SWITCH_IFACES);
+		if (!ifaces)
+			goto nla_put_failure;
 
-	/* beacon_after params */
-	ret = set_beacon_data(msg, &settings->beacon_after);
-	if (ret)
-		goto error;
+		for (i = 0; i < num_settings; i++) {
+			struct nlattr *iface;
 
-	/* beacon_csa params */
-	beacon_csa = nla_nest_start(msg, NL80211_ATTR_CSA_IES);
-	if (!beacon_csa)
-		goto nla_put_failure;
+			iface = nla_nest_start(msg, i + 1);
+			ret = set_csa_settings(msg, &settings[i]);
+			nla_nest_end(msg, iface);
 
-	ret = set_beacon_data(msg, &settings->beacon_csa);
-	if (ret)
-		goto error;
-
-	NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_BEACON,
-		    settings->counter_offset_beacon);
+			if (ret)
+				goto error;
+		}
 
-	if (settings->beacon_csa.probe_resp)
-		NLA_PUT_U16(msg, NL80211_ATTR_CSA_C_OFF_PRESP,
-			    settings->counter_offset_presp);
+		nla_nest_end(msg, ifaces);
+	}
 
-	nla_nest_end(msg, beacon_csa);
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	if (ret) {
 		wpa_printf(MSG_DEBUG, "nl80211: switch_channel failed err=%d (%s)",
 			   ret, strerror(-ret));
 	}
+
 	return ret;
 
 nla_put_failure:
-- 
1.7.9.5



From greearb  Fri Jan 31 09:23:29 2014
From: greearb (Ben Greear)
Date: Fri, 31 Jan 2014 09:23:29 -0800
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: <52EBDC11.2050104@candelatech.com>

On 01/31/2014 05:55 AM, Johannes Berg wrote:
> On Wed, 2014-01-15 at 09:18 -0800, Ben Greear wrote:
>
>>> Now, I'm not necessarily saying this would be a bad thing, but as it
>>> stands right now I'm not convinced that this can be done.
>>
>> I'm not trying to force a driver to do anything, but I would definitely
>> like to suggest a driver give the management packets high priority,
>> and for drivers I can use and modify, I will try to make sure they work
>> properly.  Other driver writers can do as they wish.
>
> Sure, that's all well, I guess I'm just a bit worried that other drivers
> might interpret those priority values of 256+ as different specials, and
> the wrong thing would happen if this change was done generically in
> wpa_s.

Well, how many drivers are there, anyway?  Maybe a simple grep would show
any conflicts.  I'll go poke around this when I get a chance.

>
>> If anyone can proclaim an API, then you can.  If you have another API in mind,
>> please detail it.  If no one cares, then I can just carry the hostap patch in
>> my own tree and move on to other things.
>
> 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.

In the past, there was a big push to move/keep 'policy' out of the kernel
and into user-space.  You would be doing the opposite.

Your suggestion, unless backported, would not fix older kernels
either.

But, I don't care that much either way, so whatever you decide is fine
with me.

Thanks,
Ben


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



From johannes  Fri Jan 31 12:06:18 2014
From: johannes (Johannes Berg)
Date: Fri, 31 Jan 2014 21:06:18 +0100
Subject: [PATCH 1/2] supplicant: Use high-priority queue for management
	packets.
In-Reply-To: <52EBDC11.2050104@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>
	<52EBDC11.2050104@candelatech.com>
Message-ID: <1391198778.4141.28.camel@jlt4.sipsolutions.net>

On Fri, 2014-01-31 at 09:23 -0800, Ben Greear wrote:

> Well, how many drivers are there, anyway?  Maybe a simple grep would show
> any conflicts.  I'll go poke around this when I get a chance.

I'd be more concerned about those drivers you *don't* know about, all
those proprietary or semi-open drivers that use cfg80211/nl80211.

Personally though, I'm not concerned, I know of no such driver that's
worth worrying about, but Jouni might disagree :)

> > 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.
> 
> In the past, there was a big push to move/keep 'policy' out of the kernel
> and into user-space.  You would be doing the opposite.
> 
> Your suggestion, unless backported, would not fix older kernels
> either.

Yeah, I'm not sure that's better. But I'm not sure relying on a
special/magic API is better either? It's a grey area for sure ...

johannes



From ejas.sheriff  Fri Jan 31 18:35:26 2014
From: ejas.sheriff (Sheriff Manzoor)
Date: Sat, 1 Feb 2014 08:05:26 +0530
Subject: Hotspot 2.0 support in wpa_supplicant and hostapd.
Message-ID: <CAJio1TqObdgF8hcpbTfTfFoh8xc0kvmRcf7gon_ySRbe5ZR3aQ@mail.gmail.com>

Hi all,

       I have been trying to understand the Hostapd and wpa_supplicant code
and came across the Hotspot 2.0 capability implementation. I would like to
know if

1) The code has the complete support of HS 2.0 capability ?
2) Some application has to be used used with CLI to create the capability?
3) Is there any setup procedure available to understand on this?


Thanks in advance
Sheriff Manzoor F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.shmoo.com/pipermail/hostap/attachments/20140201/173876a3/attachment.htm>


