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
Jouni Malinen | 18 Aug 20:04 2014
Picon

[PATCH] STA: update scan results for ap_scan = 1 case also

Change-Id: Ic5a4db271b38f310f567bf9f536a9d95f2a599e6
Signed-off-by: Dmitry Shmidt <dimitrysh <at> google.com>
---
 wpa_supplicant/events.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 2d0b827..c6df420 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
 <at>  <at>  -83,14 +83,33  <at>  <at>  static struct wpa_bss * wpa_supplicant_get_new_bss(
 }

 
+static void wpa_supplicant_update_current_bss(struct wpa_supplicant *wpa_s)
+{
+	struct wpa_bss *bss;
+
+	bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid);
+	if (!bss) {
+		wpa_supplicant_update_scan_results(wpa_s);
+
+		/* Get the BSS from the new scan results */
+		bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid);
+	}
+
+	if (bss)
+		wpa_s->current_bss = bss;
+}
+
+
 static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
 {
 	struct wpa_ssid *ssid, *old_ssid;
 	struct wpa_bss *bss;
 	int res;

-	if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid)
+	if (wpa_s->conf->ap_scan == 1 && wpa_s->current_ssid) {
+		wpa_supplicant_update_current_bss(wpa_s);
 		return 0;
+	}

 	wpa_dbg(wpa_s, MSG_DEBUG, "Select network based on association "
 		"information");
 <at>  <at>  -136,16 +155,7  <at>  <at>  static int wpa_supplicant_select_config(struct wpa_supplicant *wpa_s)
 	old_ssid = wpa_s->current_ssid;
 	wpa_s->current_ssid = ssid;

-	bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid);
-	if (!bss) {
-		wpa_supplicant_update_scan_results(wpa_s);
-
-		/* Get the BSS from the new scan results */
-		bss = wpa_supplicant_get_new_bss(wpa_s, wpa_s->bssid);
-	}
-
-	if (bss)
-		wpa_s->current_bss = bss;
+	wpa_supplicant_update_current_bss(wpa_s);

 	wpa_supplicant_rsn_supp_set_config(wpa_s, wpa_s->current_ssid);
 	wpa_supplicant_initiate_eapol(wpa_s);
--

-- 
2.1.0.rc2.206.gedb03e5
a.brooks2 | 17 Aug 14:48 2014

Signal strength through DBus interface

Hi,

I'm trying to interface to wpa_supplicant through the DBus interface -- 
specifically I want to monitor the RSSI of my connection.
I can find the BSS that it's connected to and read the "Signal" 
property, so far so good.  But I notice that it updates only very slowly 
(whereas I can see it change in real-time using e.g. "/sbin/iw wlan0 
link").

Is this expected?  Is there a way to see the signal change faster 
through the DBus interface?

Thanks in advance,

Alex
Dmitry Shmidt | 15 Aug 01:56 2014
Picon

[PATCH] Remove WPA_EVENT_SCAN_STARTED message from MSG_INFO log

Change-Id: I87638aae98ef8226a40de968910b03b2c102be35
Signed-off-by: Dmitry Shmidt <dimitrysh <at> google.com>
---
 wpa_supplicant/events.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 2d0b827..33e31b9 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
 <at>  <at>  -2990,15 +2990,17  <at>  <at>  void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 			wpa_s->own_scan_running = 1;
 			if (wpa_s->last_scan_req == MANUAL_SCAN_REQ &&
 			    wpa_s->manual_scan_use_id) {
-				wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED "id=%u",
-					wpa_s->manual_scan_id);
+				wpa_msg_ctrl(wpa_s, MSG_INFO,
+					     WPA_EVENT_SCAN_STARTED "id=%u",
+					     wpa_s->manual_scan_id);
 			} else {
-				wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED);
+				wpa_msg_ctrl(wpa_s, MSG_INFO,
+					     WPA_EVENT_SCAN_STARTED);
 			}
 		} else {
 			wpa_dbg(wpa_s, MSG_DEBUG, "External program started a scan");
 			wpa_s->external_scan_running = 1;
-			wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED);
+			wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_STARTED);
 		}
 		break;
 	case EVENT_SCAN_RESULTS:
--

-- 
2.1.0.rc2.206.gedb03e5
Steven Stromer | 14 Aug 03:52 2014

Frequent client disassociations reported by hostapd

Failing to get much useful feedback from the DD-WRT community regarding frequent client disassociations
and deauthentications logged by hostapd, I am hoping to get more knowledge from the source.

A thread has existed for months regarding these client disassociations on Atheros-based wireless
routing equipment within the DD-WRT forums:
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=171400&postdays=0&postorder=asc&start=0

While the Atheros drivers have been the leading suspect to date for the errors I am receiving (see below),
may this be stemming from another source? Might it have something to do with RADIUS authentication? It
seems the disassociation always immediately follows the start of an associated RADIUS accounting
session. Just a thought. 

Also, the error log specifically states that the deauthentication is due to inactivity. How does the
DEAUTH/REMOVE timer function? Might there simply be a bug in how associations are being timestamped?
Just another thought.

Forum rumors are that other router software vendors, such as Tomato, have been able to successfully
address this bug. Seemingly not so with DD-WRT. Any insights would be VERY much appreciated!

LOG:

# an unsuccessful connection 
Jul 17 21:37:19 router1 daemon.info hostapd: ath0: STA 68:09:27:66:ff:92 IEEE 802.11: authenticated 
Jul 17 21:37:19 router1 daemon.info hostapd: ath0: STA 68:09:27:66:ff:92 IEEE 802.11: associated (aid
6) 
Jul 17 21:37:19 router1 daemon.info hostapd: ath0: STA 68:09:27:66:ff:92 RADIUS: starting accounting
session 00000003-00000252 
Jul 17 21:37:35 router1 daemon.info hostapd: ath0: STA 68:09:27:66:ff:92 IEEE 802.11: disassociated 
Jul 17 21:37:36 router1 daemon.info hostapd: ath0: STA 68:09:27:66:ff:92 IEEE 802.11: deauthenticated
due to inactivity (timer DEAUTH/REMOVE) 

# successful connection immediately thereafter 
Jul 17 21:37:43 router1 daemon.info hostapd: ath0: STA 68:a8:6d:cc:b4:82 IEEE 802.11: authenticated 
Jul 17 21:37:43 router1 daemon.info hostapd: ath0: STA 68:a8:6d:cc:b4:82 IEEE 802.11: associated (aid
6) 
Jul 17 21:37:43 router1 daemon.info hostapd: ath0: STA 68:a8:6d:cc:b4:82 RADIUS: starting accounting
session 00000003-00000253 

# another successful connection immediately thereafter 
Jul 17 21:37:45 router1 daemon.info hostapd: ath0: STA 2c:be:08:ad:46:f6 IEEE 802.11: authenticated 
Jul 17 21:37:45 router1 daemon.info hostapd: ath0: STA 2c:be:08:ad:46:f6 IEEE 802.11: associated (aid
10) 
Jul 17 21:37:45 router1 daemon.info hostapd: ath0: STA 2c:be:08:ad:46:f6 RADIUS: starting accounting
session 00000003-00000254 

# an unsuccessful connection, followed by a successful connection of the same client host immediately
thereafter 
Jul 17 21:37:57 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a IEEE 802.11: authenticated 
Jul 17 21:37:57 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a IEEE 802.11: associated (aid
9) 
Jul 17 21:37:57 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a RADIUS: starting accounting
session 00000008-000000E6 
Jul 17 21:38:11 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a IEEE 802.11: disassociated 
Jul 17 21:38:12 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a IEEE 802.11: deauthenticated
due to inactivity (timer DEAUTH/REMOVE) 
Jul 17 21:38:16 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a IEEE 802.11: authenticated 
Jul 17 21:38:16 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a IEEE 802.11: associated (aid
9) 
Jul 17 21:38:16 router1 daemon.info hostapd: ath1: STA d0:e1:40:91:3c:3a RADIUS: starting accounting
session 00000008-000000E7

Gmane