diff mbox series

Show [UTF-8] flag if the SSID is reported as UTF-8

Message ID 20180625202415.GA3982@Mindship-03
State Accepted
Headers show
Series Show [UTF-8] flag if the SSID is reported as UTF-8 | expand

Commit Message

Jouke Witteveen June 25, 2018, 8:24 p.m. UTC
Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
---

I am not sure what decides which flags to show. This might be useful
information for scripts that process SSIDs. However, I found that in my
environment, no APs appear to actually set the UTF-8 field.

Regards,
- Jouke

 wpa_supplicant/ctrl_iface.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jouke Witteveen June 28, 2018, 8:25 p.m. UTC | #1
On Mon, Jun 25, 2018 at 10:24 PM Jouke Witteveen <j.witteveen@gmail.com> wrote:
>
> Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
> ---
>
> I am not sure what decides which flags to show. This might be useful
> information for scripts that process SSIDs. However, I found that in my
> environment, no APs appear to actually set the UTF-8 field.
>
> Regards,
> - Jouke
>
>  wpa_supplicant/ctrl_iface.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
> index fe39c25b7..8a922df47 100644
> --- a/wpa_supplicant/ctrl_iface.c
> +++ b/wpa_supplicant/ctrl_iface.c
> @@ -2879,6 +2879,13 @@ static int wpa_supplicant_ctrl_iface_scan_result(
>                         return -1;
>                 pos += ret;
>         }
> +       ie = wpa_bss_get_ie(bss, WLAN_EID_EXT_CAPAB);
> +       if (ie && ie[1] >= 6 && ie[8] & BIT(1)) { /* Bit 48 - UTF-8 SSID */

Oops! That should be BIT(0). In my testing I used 0x01, but at the
last moment I realized that this would be a good place to use the BIT
macro.
The rest of the code is a bit inconsistent in this matter, with
wpa_supplicant/bss.c using the most verbose form:

WPA_GET_LE16(ie + 2) & BIT(...)

Before messing about with new versions of this patch, I would like to
hear what others think about it.

Regards,
- Jouke

> +               ret = os_snprintf(pos, end - pos, "[UTF-8]");
> +               if (os_snprintf_error(end - pos, ret))
> +                       return -1;
> +               pos += ret;
> +       }
>  #ifdef CONFIG_HS20
>         if (wpa_bss_get_vendor_ie(bss, HS20_IE_VENDOR_TYPE) && ie2) {
>                 ret = os_snprintf(pos, end - pos, "[HS20]");
> --
> 2.18.0
>
Jouni Malinen Jan. 2, 2019, 5:18 p.m. UTC | #2
Thanks, applied.
diff mbox series

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index fe39c25b7..8a922df47 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -2879,6 +2879,13 @@  static int wpa_supplicant_ctrl_iface_scan_result(
 			return -1;
 		pos += ret;
 	}
+	ie = wpa_bss_get_ie(bss, WLAN_EID_EXT_CAPAB);
+	if (ie && ie[1] >= 6 && ie[8] & BIT(1)) { /* Bit 48 - UTF-8 SSID */
+		ret = os_snprintf(pos, end - pos, "[UTF-8]");
+		if (os_snprintf_error(end - pos, ret))
+			return -1;
+		pos += ret;
+	}
 #ifdef CONFIG_HS20
 	if (wpa_bss_get_vendor_ie(bss, HS20_IE_VENDOR_TYPE) && ie2) {
 		ret = os_snprintf(pos, end - pos, "[HS20]");