dbus: Share BSSID of AP in Credentials signal

Message ID 20180703111723epcas5p2774ab55fd2401b31522802ab75f12353~917pjfbjV1016810168epcas5p2F@epcas5p2.samsung.com
State Changes Requested
Headers show
Series
  • dbus: Share BSSID of AP in Credentials signal
Related show

Commit Message

Saurav Babu July 3, 2018, 11:17 a.m.
wpa_s->current_ssid->bssid is empty when Credentials signal is sent
whereas cred->mac_addr contains actual MAC Address of AP for which
Credentials signal is being sent.
This patch sends cred->mac_addr as BSSID in Credentials signal so that
application is aware about the actual MAC Address of the AP for which
signal is received

Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
---
 wpa_supplicant/dbus/dbus_new.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Dan Williams Oct. 16, 2018, 5:32 p.m. | #1
On Tue, 2018-07-03 at 16:47 +0530, Saurav Babu wrote:
> wpa_s->current_ssid->bssid is empty when Credentials signal is sent
> whereas cred->mac_addr contains actual MAC Address of AP for which
> Credentials signal is being sent.
> This patch sends cred->mac_addr as BSSID in Credentials signal so
> that
> application is aware about the actual MAC Address of the AP for which
> signal is received

LGTM

Dan

> Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
> ---
>  wpa_supplicant/dbus/dbus_new.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/wpa_supplicant/dbus/dbus_new.c
> b/wpa_supplicant/dbus/dbus_new.c
> index e0f16bb..1a4ffc4 100644
> --- a/wpa_supplicant/dbus/dbus_new.c
> +++ b/wpa_supplicant/dbus/dbus_new.c
> @@ -764,10 +764,9 @@ void wpas_dbus_signal_wps_cred(struct
> wpa_supplicant *wpa_s,
>  	if (cred->encr_type & WPS_ENCR_AES)
>  		encr_type[et_num++] = "aes";
>  
> -	if ((wpa_s->current_ssid &&
> -	     !wpa_dbus_dict_append_byte_array(
> +	if (!wpa_dbus_dict_append_byte_array(
>  		     &dict_iter, "BSSID",
> -		     (const char *) wpa_s->current_ssid->bssid,
> ETH_ALEN)) ||
> +		     (const char *) cred->mac_addr, ETH_ALEN) ||
>  	    !wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
>  					     (const char *) cred-
> >ssid,
>  					     cred->ssid_len) ||
Jouni Malinen Jan. 2, 2019, 10:33 p.m. | #2
On Tue, Jul 03, 2018 at 04:47:15PM +0530, Saurav Babu wrote:
> wpa_s->current_ssid->bssid is empty when Credentials signal is sent
> whereas cred->mac_addr contains actual MAC Address of AP for which
> Credentials signal is being sent.

wpa_s->current_ssid->bssid looks incorrect here, but cred->mac_addr is
no better since it is not the MAC address of the AP, it is the MAC
address of the WPS Enrollee, i.e., the receives of this Credential. When
wpa_supplicant/station is the Enrollee, this address is the MAC address
of the local station, not the BSSID of the AP that happens to be
forwarding that WPS credential to the station.

> This patch sends cred->mac_addr as BSSID in Credentials signal so that
> application is aware about the actual MAC Address of the AP for which
> signal is received

That is not BSSID, so that value should not be exposed in a field called
BSSID. What would this BSSID field be used for in the first place?
wpa_s->bssid would likely contain the BSSID value, but I don't really
see much, if any, value in exposing it externally here..

Patch

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index e0f16bb..1a4ffc4 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -764,10 +764,9 @@  void wpas_dbus_signal_wps_cred(struct wpa_supplicant *wpa_s,
 	if (cred->encr_type & WPS_ENCR_AES)
 		encr_type[et_num++] = "aes";
 
-	if ((wpa_s->current_ssid &&
-	     !wpa_dbus_dict_append_byte_array(
+	if (!wpa_dbus_dict_append_byte_array(
 		     &dict_iter, "BSSID",
-		     (const char *) wpa_s->current_ssid->bssid, ETH_ALEN)) ||
+		     (const char *) cred->mac_addr, ETH_ALEN) ||
 	    !wpa_dbus_dict_append_byte_array(&dict_iter, "SSID",
 					     (const char *) cred->ssid,
 					     cred->ssid_len) ||