Cannot connect to WiFi with SSID longer than 25 characters


#1

I am trying to use the Legato API for WiFi on the mangOH Red WP8548 with the WiFi IoT card, and noticed that le_wifiClient_GetSsid() returns only the first 25 characters of the SSID, instead of LE_WIFIDEFS_MAX_SSID_LENGTH which is 32 by industry standard. As a result, le_wifiClient_Connect() fails to connect to APs with SSIDs longer than 25 characters (error code -6).

Here’s a sample output from the built in Legato wifi client app. You can see the SSID being cut off after the 25th character. I have set the SSID of an AP to 25 characters and successfully connected, but anything 26 and above has failed.

   root@swi-mdm9x15:~# wifi client scan
   starting scan.
   Found:	SSID:	"Training"	Strength:-67	Ref:0x10000001
   Found:	SSID:	"timmacWiFi"	Strength:-68	Ref:0x10000011
   Found:	SSID:	"Cisco02041"	Strength:-80	Ref:0x10000007
   Found:	SSID:	"\x00"	Strength:-67	Ref:0x10000013
>> Found:	SSID:	"TheSsidIsThirtyTwoCharact"	Strength:-57	Ref:0x1000000f <<
   Found:	SSID:	"SBG6580E9"	Strength:-70	Ref:0x1000000d

I have tried Legato AF versions 17.06 through 17.09 all get the same result. Has anyone else encountered this problem and can it be fixed?


#2

Hi wangs,

Just wondering, what if you use “wifi client create [SSID]” to create the reference and connect to it?

Thx


#3

Creating the reference and connecting to it works.

root@swi-mdm9x15:~# wifi client create TheSsidIsThirtyTwoCharactersLong
Created TheSsidIsThirtyTwoCharactersLong has reference 0x1000001f.
root@swi-mdm9x15:~# wifi client setsecurityproto 0x1000001f 0
Successfully set security protocol.
root@swi-mdm9x15:~# wifi client connect 0x1000001f
Connecting...
CONNECTED.

Monitoring the log output from wifiService[793]/daemon T=WiFi Client Scan Thread:

INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 484 | Scan results
INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 504 | PARSING:	signal: -52.00 dBm : len:20
INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 517 | FOUND SIGNAL STRENGTH:	signal: -52.00 dBm   5 2 
INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 520 | FOUND SIGNAL STRENGTH: signalStrength:-52 
INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 504 | PARSING:	SSID: TheSsidIsThirtyTwoCharactersLong : len:40
INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 509 | FOUND SSID:	SSID: TheSsidIsThirtyTwoCharactersLong   Th.. 
INFO | pa_wifi_client_ti.c pa_wifiClient_GetScanResult() 512 | FOUND SSID: Parsed:"TheSsidIsThirtyTwoCharact"
DBUG | le_wifiClient.c FindAccessPointRefFromSsid() 144 | Find AP from SSID
DBUG | le_wifiClient.c AddAccessPointToApRefMap() 219 | New AP[8] SignalStrength -52 | SSID length 25 | SSID: "TheSsidIsThirtyTwoCharact"
DBUG | le_wifiClient.c AddAccessPointToApRefMap() 229 | le_ref_CreateRef foundAccessPointPtr 0x2f000; Ref0x1000001d

Something happened between lines 509 and 512 of pa_wifi_client_ti.c:

506		if (0 == strncmp("\tSSID: ", path, 7))
507		{
508			accessPointPtr->ssidLength = strnlen(path, LE_WIFIDEFS_MAX_SSID_BYTES) - 7 - 1;
509			LE_INFO("FOUND SSID:%s  %c%c.. ", path, path[7], path[8]);
510			memset(&accessPointPtr->ssidBytes, 0, LE_WIFIDEFS_MAX_SSID_BYTES);
511			memcpy (&accessPointPtr->ssidBytes, &path[7], accessPointPtr->ssidLength);
512			LE_INFO("FOUND SSID: Parsed:\"%s\"", &accessPointPtr->ssidBytes[0]);
513			return LE_OK;
514		}

Now the problem is clear, the bug occurs on line 508: LE_WIFIDEFS_MAX_SSID_BYTES(33) - 7 - 1 = 25, which explains why the SSID is limited to 25 characters.

We have a customer account and can report this bug, or are you able to put the bug into the system?


#4

Hi @wangs,

I would recommend that you create a customer ticket as it would have more weight than issues created on GitHub for instance.
If you have a clean fix and don’t mind signing the contributor agreement (https://github.com/legatoproject/legato-af/blob/master/CONTRIB_COMPANY.md), we can merge it for you.


#5

Thank you, I will submit a ticket for this issue.

A separate but related question, do you know how to connect to hidden SSIDs? wifi client create and then connecting to the reference isn’t working for me. The log output is attached.

hidden.log (14.3 KB)


#6

I unfortunately don’t know, it might be worth another ticket :confused: