Masashi Honma | 2 Sep 07:15 2014
Picon

mesh patch lost

Hello Bob.

I could not find out patch 03/20.
Could you re-send it to ML ?

Regards,
Masashi Honma.
Bob Copeland | 1 Sep 06:23 2014

[PATCH v2 00/20] mesh support for wpa_supplicant

Hello,

This is an updated posting of the mesh-for-wpa_supplicant patchset,
which allows creating an open or secure (SAE) 802.11s mesh.

Comments welcome.

New in this iteration:
 - rebased on top of master
 - refactored handle_auth_sae() so that the state machine elements
   are more obvious
 - fixed operation for AP/STA SAE such that original test cases pass again
 - fixed handling of commit frames in SAE_CONFIRMED state
 - fixed up default sae_groups config when not explicitly set
 - picked up two patches from Masashi Honma related to configuration
   and operation on Android
 - fixed a segfault at shutdown if SAE was not fully completed
 - revised a few patches to fix compilation errors in the middle of
   the series
 - changed the Signed-hostap's to Signed-off-by's.

Bob Copeland (5):
  mesh_mpm: add mesh peering manager
  driver: add new NL80211 cmds to support mesh ifaces
  mesh: parse mesh-related information elements
  aes_siv: implement RFC 5297 AES-SIV
  auth: enhance SAE implementation to handle auth for mesh interfaces

Chun-Yeow Yeoh (1):
  mesh_rsn: add timer for SAE authentication
(Continue reading)

Eduardo Abinader | 1 Sep 05:20 2014

[PATCH] nl80211: Register eloop after hs20 action frame

Even when hs20 action frame is unable to be registered,
for whatever reason, it should be possible to register
event handle for received driver messages. This patch also
avoids a segmentation fault, when p2p and hs20 were enabled
and GO NEG was unable to create p2p iface, the destroy eloop
was crashing by reading an invalid handle.

Signed-off-by: Eduardo Abinader <eduardo.abinader <at> openbossa.org>
---
 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 8ebf7d9..e67a61e 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
 <at>  <at>  -4550,7 +4550,7  <at>  <at>  static int nl80211_mgmt_subscribe_non_ap(struct i802_bss *bss)
 #ifdef CONFIG_HS20
 	/* WNM-Notification */
 	if (nl80211_register_action_frame(bss, (u8 *) "\x0a\x1a", 2) < 0)
-		return -1;
+		ret = -1;
 #endif /* CONFIG_HS20 */

 	nl80211_mgmt_handle_register_eloop(bss);
--

-- 
1.9.1
Conrad Kostecki | 30 Aug 16:40 2014
Picon

Ath10k with HostAPd very slow

Hi!
I've replaced both of my ath9k cards (Compex WLE350NX) with new ath10k cards (Compex WLE900VX). But it
seems, I've some sort of performance problems. With the new cards, the connection from clients is very
slow. The throughput, while connected with an Intel 6300 is about 3-6mbit (measured with iperf). My
Nexus4 is even slower with about 1mbit. It doesn't matter, if it's on 2.4GHz or 5GHz. Windows shows in the
connection properties, while connected to the 2.4GHz WiFi about 350-450Mbit. On 5GHz it seems to be
slower, as it shows about 150Mbit, sometimes up to 250MBit. It's goes up to 450Mbit, if I disable 802.11ac
in the configuration of hostapd. Both tests are done directly in front of the AP. I've only noticed, that in
5GHz band with 802.11ac enabled, if shows one channel and according to 
 debug log with 80MHz bandwith. In 802.11n mode only I can see two channels, with a bandwith of 40MHz.

2.4GHz startup debug log: http://pastebin.com/whxKqjWP
5GHz (802.11ac disabled) startup debug log: http://pastebin.com/LGpYUWZc
5GHz (802.11ac enabled) startup debug log: http://pastebin.com/CdP3PVw8

So, what can I do to speed up my WiFi, to make is fast, as it was with my old ath9k cards? I would expect at least
70-80Mbit in 802.11n mode, as 5Mbit can't be normal.
Does anybody has some ideas? Can I debug this somehow?

Kernel: 3.16.1
[    4.113905] ath10k: qca988x hw2.0 (0x4100016c, 0x043202ff) fw 10.1.467.2-1 api 2 htt 2.1
[    4.351541] ath10k: qca988x hw2.0 (0x4100016c, 0x043202ff) fw 10.1.467.2-1 api 2 htt 2.1

2.4GHz configuration: http://pastebin.com/wyuCkXZe
5GHz configuration: http://pastebin.com/y3u53Zzs

Thanks!
Conrad
Tomasz Bursztyka | 26 Aug 09:02 2014
Picon

[PATCH 0/3] Enable WFD Sub-elements settings through DBus

Hi,

This is a quick patch-set to support setting WFD sub-elements through DBus,
which was only possible through the socket interface before.

Difference here is that you set the whole sub-elements you want at once, through
a byte array which represent the WFD IEs. It's easier to have one property to get/set
this way rather than having specific methods to add one sub-element per sub-element.
This also follows what exists for Peer objects where you get their WFD IEs at once.

From debug output you would get then:

1409036203.375284: dbus: org.freedesktop.DBus.Properties.Set (/fi/w1/wpa_supplicant1)
1409036203.375305: WFD IEs set: 0x1999860 - 27
1409036203.375308: WFD Sub-Element ID 0 - len 6
1409036203.375311: WFD Sub-Element ID 1 - len 6
1409036203.375312: WFD Sub-Element ID 6 - len 1
1409036203.375314: WFD Sub-Element ID 7 - len 2
1409036203.375317: WFD: Update WFD IE
1409036203.375318: WFD: Wi-Fi Display disabled - do not include WFD IE
1409036203.375321: WFD: Wi-Fi Display enabled
1409036203.375323: WFD: Update WFD IE
1409036203.375326: WFD: WFD IE for Beacon - hexdump(len=28): dd 1a 50 6f 9a 0a 00 00 06 01 5d 02 2a 00 32 01 00 06
00 00 00 00 00 00 06 00 01 00
1409036203.375332: WFD: WFD IE for (Re)Association Request - hexdump(len=28): dd 1a 50 6f 9a 0a 00 00 06 01
5d 02 2a 00 32 01 00 06 00 00 00 00 00 00 06 00 01 00
1409036203.375338: WFD: WFD IE for GO Negotiation - hexdump(len=28): dd 1a 50 6f 9a 0a 00 00 06 01 5d 02 2a 00 32
01 00 06 00 00 00 00 00 00 06 00 01 00
1409036203.375344: WFD: WFD IE for Provision Discovery Request - hexdump(len=28): dd 1a 50 6f 9a 0a 00 00 06
01 5d 02 2a 00 32 01 00 06 00 00 00 00 00 00 06 00 01 00
(Continue reading)

Damiano Albani | 25 Aug 23:03 2014
Picon

Building a repeater for 802.1x AP

Hello,

Is it even remotely possible to use a combination of hostapd + wpa_supplicant to build a repeater for an AP with 802.1x authentication?
This repeater would act as a kind of proxy for 802.1x / EAP messages, forwarding them back and forth between the "real" STA and AP in order to gain access.
Then it could act as a bridge or even as an IP router, providing NAT if necessary.
My main use case would apply to an EAP-SIM context.

Thanks,

--
Damiano Albani
_______________________________________________
HostAP mailing list
HostAP <at> lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap
Conrad Kostecki | 24 Aug 23:51 2014
Picon

DFS start_dfs_cac() failed, -1 / nl80211: Failed to start radar detection: -16 (Device or resource busy)

Dear Mailinglist,
I am trying to run hostapd acting in 5GHz mode with enable DFS. This seems not to be possible for me, as it fails.

I am using ath9k, AR9590. Kernel is 3.16.1 and hostapd version 2.2.

-- snip --
ACS: Ideal channel is 116 (5580 MHz) with total interference factor of 1.14549e-18
wlp7s0: ACS-COMPLETED freq=5580 channel=116
HT40: control channel: 116  secondary channel: 120
Completing interface initialization
Mode: IEEE 802.11a  Channel: 116  Frequency: 5580 MHz
DFS 2 channels required radar detection
DFS all channels available, (SKIP CAC): no
DFS 0 chans unavailable - choose other channel: no
wlp7s0: interface state ACS->DFS
DFS start CAC on 5580 MHz
wlp7s0: DFS-CAC-START freq=5580 chan=116 sec_chan=1, width=0, seg0=0, seg1=0, cac_time=60s
nl80211: Start radar detection (CAC) 5580 MHz (ht_enabled=1, vht_enabled=0, bandwidth=40 MHz,
cf1=5590 MHz, cf2=0 MHz)
nl80211: Failed to start radar detection: -16 (Device or resource busy)
DFS start_dfs_cac() failed, -1
-- snip --

Why it does says, that device or resource is busy? When I run hostapd in 2.4GHz mode, it's working perfectly
fine for me. Does anybody has some idea? I am not trying to run 2.4GHZ / 5.0GHz simultaneous.

Thanks!
Conrad 
Eduardo Abinader | 21 Aug 05:30 2014

[PATCH] P2P: Deauth p2p client just after dbus notify

Currently to signal PropertiesChanged upon group client
removal (group property), wpa_supplicant dbus uses wpa_s
members like go_dev_addr and current_ssid, for instance.
Thus, deferring p2p client deauth to after dbus notify,
but keeping the same order as before, solves the issue,
as wpa_s is not yet completely deinitialized.

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

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index d91877c..a3fca03 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
 <at>  <at>  -449,11 +449,16  <at>  <at>  static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
 		 (ssid && ssid->mode == WPAS_MODE_INFRA)) {
 		wpa_s->reassociate = 0;
 		wpa_s->disconnected = 1;
-		wpa_supplicant_deauthenticate(wpa_s,
-					      WLAN_REASON_DEAUTH_LEAVING);
 		gtype = "client";
 	} else
 		gtype = "GO";
+
+	if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid)
+		wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);
+
+	if (os_strcmp(gtype, "client") == 0)
+		wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
+
 	if (wpa_s->cross_connect_in_use) {
 		wpa_s->cross_connect_in_use = 0;
 		wpa_msg_global(wpa_s->parent, MSG_INFO,
 <at>  <at>  -511,9 +516,6  <at>  <at>  static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
 	 */
 	wpa_s->global->p2p_go_wait_client.sec = 0;

-	if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid)
-		wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);
-
 	if (wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) {
 		struct wpa_global *global;
 		char *ifname;
--

-- 
1.9.1
Jithu Jance | 20 Aug 18:46 2014
Picon

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

Hi Jouni,

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

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

diff --git a/wpa_supplicant/offchannel.c b/wpa_supplicant/offchannel.c
index 77683b6..17689c5 100644
--- a/wpa_supplicant/offchannel.c
+++ b/wpa_supplicant/offchannel.c
 <at>  <at>  -12,6 +12,7  <at>  <at> 
 #include "common.h"
 #include "utils/eloop.h"
 #include "wpa_supplicant_i.h"
+#include "p2p_supplicant.h"
 #include "driver_i.h"
 #include "offchannel.h"

 <at>  <at>  -188,6 +189,12  <at>  <at>  void offchannel_send_action_tx_status(
  wpa_s->pending_action_bssid,
  data, data_len, result);
  }
+
+ if (wpa_s->p2p_long_listen > 0) {
+ /* Continue the listen */
+ wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
+ wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
+ }
 }

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

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

On Wed, Aug 13, 2014 at 8:21 PM, Jithu Jance <jithujance <at> gmail.com> wrote:
> Hi Jouni,
>
> Thanks for your review comments.
>
>>
>>>       if (wpa_s->p2p_long_listen > 0)
>>>               wpa_s->p2p_long_listen -= wpa_s->max_remain_on_chan;
>>> -     if (wpa_s->p2p_long_listen > 0) {
>>> -             wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
>>> -             wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
>>> -     } else {
>>> +     else {
>>
>> This looks incorrect.. The previous version decremented
>> wpa_s->p2p_long_listen first and only after that compared it to >0 (and
>> well, <=0 in case of the else clause).
>>
>>>               /*
>>>                * When listen duration is over, stop listen & update p2p_state
>>>                * to IDLE.
>>>                */
>>>               p2p_stop_listen(wpa_s->global->p2p);
>>>       }
>>
>> So this could potentially not happen for the first time p2p_long_listen
>> drops to zero (or below).
>
> Got it. Thanks! I moved this piece of code above
> offchannel_pending_listen is to make sure that p2p_long_listen is
> updated in
> the remain_on_channel_cb context itself and to avoid moving the code
> to wpas_p2p_continue_listen_context. So that in case,
> p2p_long_listen is accessed in between, it has an updated value
> (though it is not done currently).
>
>
>>
>> Unless I'm missing something here, more appropriate way of addressing
>> this would be to have the completion of the pending Action frame TX
>> schedule a new P2P Listen if wpa_s->p2p_long_listen > 0.
> Sounds good!. You mean offchannel_send_action_tx_status function?
> Let me know whether below patch is fine. I have moved the p2p_long_listen
> above to make sure that it remains updated even if we return from offchannel_tx
> or listen_end. Hope it is fine.
>
_______________________________________________
HostAP mailing list
HostAP <at> lists.shmoo.com
http://lists.shmoo.com/mailman/listinfo/hostap
Masashi Honma | 20 Aug 08:53 2014
Picon

[PATCH] mesh: Add scan result for mesh network

Android 4.4 uses "BSS" command instead of "SCAN_RESULT" command.
So this patch add the mesh scan result for BSS command.

Signed-off-by: Masashi Honma <masashi.honma <at> gmail.com>
---
 src/common/wpa_ctrl.h       |  1 +
 wpa_supplicant/ctrl_iface.c | 11 ++++++
 wpa_supplicant/mesh.c       | 93 +++++++++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/mesh.h       |  2 +
 4 files changed, 107 insertions(+)

diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index 521b97b..e0ee1dc 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
 <at>  <at>  -243,6 +243,7  <at>  <at>  extern "C" {
 #define WPA_BSS_MASK_INTERNETW		BIT(15)
 #define WPA_BSS_MASK_WIFI_DISPLAY	BIT(16)
 #define WPA_BSS_MASK_DELIM		BIT(17)
+#define WPA_BSS_MASK_MESH_SCAN		BIT(18)

 
 /* VENDOR_ELEM_* frame id values */
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 130449a..d782c7e 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
 <at>  <at>  -41,6 +41,7  <at>  <at> 
 #include "autoscan.h"
 #include "wnm_sta.h"
 #include "offchannel.h"
+#include "mesh.h"

 static int wpa_supplicant_global_iface_list(struct wpa_global *global,
 					    char *buf, int len);
 <at>  <at>  -3816,6 +3817,16  <at>  <at>  static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
 	}
 #endif /* CONFIG_INTERWORKING */

+#ifdef CONFIG_MESH
+	if (mask & WPA_BSS_MASK_MESH_SCAN) {
+		ie = (const u8 *) (bss + 1);
+		ret = wpas_mesh_scan_result_text(ie, bss->ie_len, pos, end);
+		if (ret < 0 || ret >= end - pos)
+			return 0;
+		pos += ret;
+	}
+#endif /* CONFIG_MESH */
+
 	if (mask & WPA_BSS_MASK_DELIM) {
 		ret = os_snprintf(pos, end - pos, "====\n");
 		if (ret < 0 || ret >= end - pos)
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 07f1ff8..e0b4e2e 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
 <at>  <at>  -333,3 +333,96  <at>  <at>  int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s)

 	return ret;
 }
+
+
+static int mesh_attr_text(const u8 *ies, size_t ies_len, char *buf, char *end)
+{
+	struct ieee802_11_elems elems;
+	char *mesh_id, *pos = buf;
+	u8 *bss_basic_rate_set;
+	int bss_basic_rate_set_len, ret, i;
+
+	if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == ParseFailed)
+		return -1;
+
+	if (elems.mesh_id_len < 1)
+		return 0;
+
+	mesh_id = os_malloc(elems.mesh_id_len + 1);
+	if (mesh_id == NULL)
+		return -1;
+
+	os_memcpy(mesh_id, elems.mesh_id, elems.mesh_id_len);
+	mesh_id[elems.mesh_id_len] = '\0';
+	ret = os_snprintf(pos, end - pos, "mesh_id=%s\n", mesh_id);
+	os_free(mesh_id);
+	if (ret < 0 || ret >= end - pos)
+		return pos - buf;
+	pos += ret;
+
+	if (elems.mesh_config_len > 6) {
+		ret = os_snprintf(pos, end - pos,
+			"active_path_selection_protocol_id=0x%02x\n"
+			"active_path_selection_metric_id=0x%02x\n"
+			"congestion_control_mode_id=0x%02x\n"
+			"synchronization_method_id=0x%02x\n"
+			"authentication_protocol_id=0x%02x\n"
+			"mesh_formation_info=0x%02x\n"
+			"mesh_capability=0x%02x\n", elems.mesh_config[0],
+			elems.mesh_config[1], elems.mesh_config[2],
+			elems.mesh_config[3], elems.mesh_config[4],
+			elems.mesh_config[5], elems.mesh_config[6]);
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+
+	bss_basic_rate_set = os_malloc(elems.supp_rates_len +
+		elems.ext_supp_rates_len);
+	if (bss_basic_rate_set == NULL)
+		return -1;
+
+	bss_basic_rate_set_len = 0;
+	for (i = 0; i < elems.supp_rates_len; i++) {
+		if (elems.supp_rates[i] & 0x80) {
+			bss_basic_rate_set[bss_basic_rate_set_len++] =
+				(elems.supp_rates[i] & 0x7f) * 5;
+		}
+	}
+	for (i = 0; i < elems.ext_supp_rates_len; i++) {
+		if (elems.ext_supp_rates[i] & 0x80) {
+			bss_basic_rate_set[bss_basic_rate_set_len++] =
+				(elems.ext_supp_rates[i] & 0x7f) * 5;
+		}
+	}
+	if (bss_basic_rate_set_len > 0) {
+		ret = os_snprintf(pos, end - pos, "bss_basic_rate_set=%d",
+				  bss_basic_rate_set[0]);
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+
+		for (i = 1; i < bss_basic_rate_set_len; i++) {
+			ret = os_snprintf(pos, end - pos, " %d",
+					  bss_basic_rate_set[i]);
+			if (ret < 0 || ret >= end - pos)
+				return pos - buf;
+			pos += ret;
+		}
+
+		ret = os_snprintf(pos, end - pos, "\n");
+		if (ret < 0 || ret >= end - pos)
+			return pos - buf;
+		pos += ret;
+	}
+	os_free(bss_basic_rate_set);
+
+	return pos - buf;
+}
+
+
+int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
+			       char *end)
+{
+	return mesh_attr_text(ies, ies_len, buf, end);
+}
diff --git a/wpa_supplicant/mesh.h b/wpa_supplicant/mesh.h
index 9b14ecf..e82ec79 100644
--- a/wpa_supplicant/mesh.h
+++ b/wpa_supplicant/mesh.h
 <at>  <at>  -35,4 +35,6  <at>  <at>  void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s,
 				     struct wpabuf **extra_ie);
 void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s,
 				      struct hostapd_iface *ifmsh);
+int wpas_mesh_scan_result_text(const u8 *ies, size_t ies_len, char *buf,
+			       char *end);
 #endif /* MESH_H */
--

-- 
1.9.1
Dan Williams | 18 Aug 22:00 2014
Picon

[PATCH] dbus: add SignalPoll() method to report current signal properties

Analagous to the control interface's SIGNAL_POLL request.

Signed-hostap: Dan Williams <dcbw <at> redhat.com>
---
Example:

$ sudo dbus-send --system --print-reply --dest=fi.w1.wpa_supplicant1
/fi/w1/wpa_supplicant1/Interfaces/1 fi.w1.wpa_supplicant1.Interface.SignalPoll
method return sender=:1.268 -> dest=:1.273 reply_serial=2
   variant       array [
         dict entry(
            string "rssi"
            variant                int32 -47
         )
         dict entry(
            string "linkspeed"
            variant                int32 54
         )
         dict entry(
            string "noise"
            variant                int32 9999
         )
         dict entry(
            string "frequency"
            variant                uint32 2462
         )
         dict entry(
            string "width"
            variant                string "20 MHz (no HT)"
         )
         dict entry(
            string "avg-rssi"
            variant                int32 -42
         )
      ]

 wpa_supplicant/ctrl_iface.c             | 24 +---------
 wpa_supplicant/dbus/dbus_new.c          |  7 +++
 wpa_supplicant/dbus/dbus_new_handlers.c | 81 +++++++++++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  3 ++
 wpa_supplicant/wpas_glue.c              | 21 +++++++++
 wpa_supplicant/wpas_glue.h              |  3 ++
 6 files changed, 116 insertions(+), 23 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 9970597..fe31805 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
 <at>  <at>  -37,14 +37,15  <at>  <at> 
 #include "scan.h"
 #include "ctrl_iface.h"
 #include "interworking.h"
 #include "blacklist.h"
 #include "autoscan.h"
 #include "wnm_sta.h"
 #include "offchannel.h"
+#include "wpas_glue.h"

 static int wpa_supplicant_global_iface_list(struct wpa_global *global,
 					    char *buf, int len);
 static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
 						  char *buf, int len);
 static int * freq_range_to_channel_list(struct wpa_supplicant *wpa_s,
 					char *val);
 <at>  <at>  -5448,37 +5449,14  <at>  <at>  static int wpas_ctrl_iface_wnm_bss_query(struct wpa_supplicant *wpa_s, char *cmd
 		   query_reason);

 	return wnm_send_bss_transition_mgmt_query(wpa_s, query_reason);
 }

 #endif /* CONFIG_WNM */

-
-/* Get string representation of channel width */
-static const char * channel_width_name(enum chan_width width)
-{
-	switch (width) {
-	case CHAN_WIDTH_20_NOHT:
-		return "20 MHz (no HT)";
-	case CHAN_WIDTH_20:
-		return "20 MHz";
-	case CHAN_WIDTH_40:
-		return "40 MHz";
-	case CHAN_WIDTH_80:
-		return "80 MHz";
-	case CHAN_WIDTH_80P80:
-		return "80+80 MHz";
-	case CHAN_WIDTH_160:
-		return "160 MHz";
-	default:
-		return "unknown";
-	}
-}
-
-
 static int wpa_supplicant_signal_poll(struct wpa_supplicant *wpa_s, char *buf,
 				      size_t buflen)
 {
 	struct wpa_signal_info si;
 	int ret;
 	char *pos, *end;

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index aab2225..7cee614 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
 <at>  <at>  -2433,14 +2433,21  <at>  <at>  static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 	{ "Scan", WPAS_DBUS_NEW_IFACE_INTERFACE,
 	  (WPADBusMethodHandler) &wpas_dbus_handler_scan,
 	  {
 		  { "args", "a{sv}", ARG_IN },
 		  END_ARGS
 	  }
 	},
+	{ "SignalPoll", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) &wpas_dbus_handler_signal_poll,
+	  {
+		  { "args", "a{sv}", ARG_OUT },
+		  END_ARGS
+	  }
+	},
 	{ "Disconnect", WPAS_DBUS_NEW_IFACE_INTERFACE,
 	  (WPADBusMethodHandler) &wpas_dbus_handler_disconnect,
 	  {
 		  END_ARGS
 	  }
 	},
 	{ "AddNetwork", WPAS_DBUS_NEW_IFACE_INTERFACE,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index bd38d65..a9c65cc 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
 <at>  <at>  -23,14 +23,15  <at>  <at> 
 #include "../scan.h"
 #include "../autoscan.h"
 #include "dbus_new_helpers.h"
 #include "dbus_new.h"
 #include "dbus_new_handlers.h"
 #include "dbus_dict_helpers.h"
 #include "dbus_common_i.h"
+#include "../wpas_glue.h"

 static const char *debug_strings[] = {
 	"excessive", "msgdump", "debug", "info", "warning", "error", NULL
 };

 
 /**
 <at>  <at>  -1386,14 +1387,94  <at>  <at>  out:
 	for (i = 0; i < WPAS_MAX_SCAN_SSIDS; i++)
 		os_free((u8 *) params.ssids[i].ssid);
 	os_free((u8 *) params.extra_ies);
 	os_free(params.freqs);
 	return reply;
 }

+/**
+ * wpas_dbus_handler_signal_poll - Request immediate signal properties
+ *  <at> message: Pointer to incoming dbus message
+ *  <at> wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "SignalPoll" method call of a network device. Requests
+ * that wpa_supplicant read signal properties like RSSI, noise, and link
+ * speed and return them.
+ */
+DBusMessage * wpas_dbus_handler_signal_poll(DBusMessage *message,
+					    struct wpa_supplicant *wpa_s)
+{
+	struct wpa_signal_info si;
+	DBusMessage *reply = NULL;
+	DBusMessageIter iter, iter_dict, variant_iter;
+	int ret;
+
+	ret = wpa_drv_signal_poll(wpa_s, &si);
+	if (ret) {
+		return dbus_message_new_error(message, DBUS_ERROR_FAILED,
+					      "Failed to read signal");
+	}
+
+	reply = dbus_message_new_method_return(message);
+	if (reply == NULL)
+		goto nomem;
+
+	dbus_message_iter_init_append(reply, &iter);
+
+	if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT,
+					      "a{sv}", &variant_iter))
+		goto nomem;
+	if (!wpa_dbus_dict_open_write(&variant_iter, &iter_dict))
+		goto nomem;
+
+	if (!wpa_dbus_dict_append_int32(&iter_dict, "rssi", si.current_signal))
+		goto nomem;
+	if (!wpa_dbus_dict_append_int32(&iter_dict, "linkspeed",
+					si.current_txrate / 1000))
+		goto nomem;
+	if (!wpa_dbus_dict_append_int32(&iter_dict, "noise", si.current_noise))
+		goto nomem;
+	if (!wpa_dbus_dict_append_uint32(&iter_dict, "frequency", si.frequency))
+		goto nomem;
+
+	if (si.chanwidth != CHAN_WIDTH_UNKNOWN) {
+		if (!wpa_dbus_dict_append_string(&iter_dict, "width",
+					channel_width_name(si.chanwidth)))
+			goto nomem;
+	}
+
+	if (si.center_frq1 > 0 && si.center_frq2 > 0) {
+		if (!wpa_dbus_dict_append_int32(&iter_dict, "center-frq1",
+						si.center_frq1))
+			goto nomem;
+		if (!wpa_dbus_dict_append_int32(&iter_dict, "center-frq2",
+						si.center_frq2))
+			goto nomem;
+	}
+
+	if (si.avg_signal) {
+		if (!wpa_dbus_dict_append_int32(&iter_dict, "avg-rssi",
+						si.avg_signal))
+			goto nomem;
+	}
+
+	if (!wpa_dbus_dict_close_write(&variant_iter, &iter_dict))
+		goto nomem;
+	if (!dbus_message_iter_close_container(&iter, &variant_iter))
+		goto nomem;
+
+	return reply;
+
+nomem:
+	if (reply)
+		dbus_message_unref(reply);
+	reply = dbus_message_new_error(message, DBUS_ERROR_NO_MEMORY, NULL);
+	return reply;
+}

 /*
  * wpas_dbus_handler_disconnect - Terminate the current connection
  *  <at> message: Pointer to incoming dbus message
  *  <at> wpa_s: wpa_supplicant structure for a network interface
  * Returns: NotConnected DBus error message if already not connected
  * or NULL otherwise.
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 461970d..f00eb88 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
 <at>  <at>  -83,14 +83,17  <at>  <at>  dbus_bool_t wpas_dbus_getter_eap_methods(DBusMessageIter *iter,
 dbus_bool_t wpas_dbus_getter_global_capabilities(DBusMessageIter *iter,
 						 DBusError *error,
 						 void *user_data);

 DBusMessage * wpas_dbus_handler_scan(DBusMessage *message,
 				     struct wpa_supplicant *wpa_s);

+DBusMessage * wpas_dbus_handler_signal_poll(DBusMessage *message,
+					    struct wpa_supplicant *wpa_s);
+
 DBusMessage * wpas_dbus_handler_disconnect(DBusMessage *message,
 					   struct wpa_supplicant *wpa_s);

 dbus_bool_t set_network_properties(struct wpa_supplicant *wpa_s,
 				   struct wpa_ssid *ssid,
 				   DBusMessageIter *iter,
 				   DBusError *error);
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 350b122..b77e5d3 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
 <at>  <at>  -966,7 +966,28  <at>  <at>  void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s,
 				wpabuf_free(p2p);
 			}
 		}
 #endif /* CONFIG_P2P */
 	}
 	wpa_sm_set_config(wpa_s->wpa, ssid ? &conf : NULL);
 }
+
+/* Get string representation of channel width */
+const char * channel_width_name(enum chan_width width)
+{
+	switch (width) {
+	case CHAN_WIDTH_20_NOHT:
+		return "20 MHz (no HT)";
+	case CHAN_WIDTH_20:
+		return "20 MHz";
+	case CHAN_WIDTH_40:
+		return "40 MHz";
+	case CHAN_WIDTH_80:
+		return "80 MHz";
+	case CHAN_WIDTH_80P80:
+		return "80+80 MHz";
+	case CHAN_WIDTH_160:
+		return "160 MHz";
+	default:
+		return "unknown";
+	}
+}
diff --git a/wpa_supplicant/wpas_glue.h b/wpa_supplicant/wpas_glue.h
index 9808c22..8dd99ff 100644
--- a/wpa_supplicant/wpas_glue.h
+++ b/wpa_supplicant/wpas_glue.h
 <at>  <at>  -6,20 +6,23  <at>  <at> 
  * See README for more details.
  */

 #ifndef WPAS_GLUE_H
 #define WPAS_GLUE_H

 enum wpa_ctrl_req_type;
+enum chan_width;

 int wpa_supplicant_init_eapol(struct wpa_supplicant *wpa_s);
 int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_rsn_supp_set_config(struct wpa_supplicant *wpa_s,
 					struct wpa_ssid *ssid);

 const char * wpa_supplicant_ctrl_req_to_string(enum wpa_ctrl_req_type field,
 					       const char *default_txt,
 					       const char **txt);

 enum wpa_ctrl_req_type wpa_supplicant_ctrl_req_from_string(const char *field);

+const char * channel_width_name(enum chan_width width);
+
 #endif /* WPAS_GLUE_H */
--

-- 
1.9.3

Gmane