[Feature][T8TSK-81]Merge MR3.0 New changes to commit ID:2b1db87cbf754219ab0e1cb48c663067ed55b7b3;GSW commit ID:4b1cf725e8037c2d878c85388384a0f5c8129274
Change-Id: Icbf9845e92b3564ad7f1d127c13c896b93a42c5b
diff --git a/src/lynq/lib/liblynq-wifi6/libwifi6.c b/src/lynq/lib/liblynq-wifi6/libwifi6.c
index d0c3c32..25e429b 100755
--- a/src/lynq/lib/liblynq-wifi6/libwifi6.c
+++ b/src/lynq/lib/liblynq-wifi6/libwifi6.c
@@ -370,7 +370,11 @@
usleep(300*1000);
system("wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=ap0 disconnect");
}
-
+ ret = system("wl -i wlan0 PM 0");
+ if( ret != 0)
+ {
+ printf("Set sta PM work mode to 0 fail,ret is%d",ret);
+ }
if (g_ap_watcher_pid == 0 ) {
ret=pthread_create(&g_ap_watcher_pid,NULL,APWatcherThreadProc,NULL);
if(ret<0){
@@ -593,7 +597,7 @@
if (NULL == mac || NULL == ip)
return -1;
memset(ip, 0, ip_len);
- sprintf(cmd, "ip neigh | grep \"lladdr\" | grep \"tether\" | grep \"%s\" | head -1 | awk '{print $1}'", mac);
+ sprintf(cmd, "ip n s | grep \"lladdr\" | grep \"%s\" | head -1 | awk '{print $1}'", mac);
ret = exec_cmd(cmd, ip, ip_len);
p = strchr(ip, '\n');
if (NULL != p)
@@ -758,7 +762,7 @@
else if (strstr( flag, "NONE") != NULL) {
return LYNQ_WIFI_AUTH_OPEN;
}
- else if (strcmp( flag, "[ESS]") == 0) {
+ else if (strcmp( flag, "[ESS]") == 0 || strcmp( flag,"[WPS][ESS]") == 0) {
return LYNQ_WIFI_AUTH_OPEN;
}
}
@@ -930,6 +934,27 @@
return 0;
}
+
+static int lynq_check_frequencyby_country_code(int input_frequency)
+{
+ char str_cnc[]="CN";
+ char str_dest[20]="";
+
+ if( lynq_get_country_code(1,str_dest) != 0 )
+ {
+ printf("get country_code error\n");
+ return -1;
+ }
+ if( strncmp(str_dest,str_cnc,2) != 0 )
+ {
+ return 0;
+ }else if( 2473 < input_frequency && input_frequency < 5744)
+ {
+ printf("input frequency is bad\n");
+ return -1;
+ }
+ return 0;
+}
int lynq_wifi_ap_frequency_set(lynq_wifi_index_e idx,int lynq_wifi_frequency)
{
int check;
@@ -944,6 +969,13 @@
printf("do check frequency error\n");
return -1;
}
+ check = lynq_check_frequencyby_country_code(lynq_wifi_frequency);
+ if(check != 0)
+ {
+ printf("do check frequency error\n");
+ return -1;
+ }
+
if (lynq_check_network_number(idx, CTRL_AP, AP_NETWORK_0) != 0)
{
return -1;
@@ -1000,7 +1032,7 @@
}
case LYNQ_WIFI_BANDWIDTH_HT40:
{
- char lynq_cmd_bandwith[MAX_CMD]="wl chanspec 153u";
+ char lynq_cmd_bandwith[MAX_CMD]="wl chanspec 149/40";
sprintf(lynq_cmd_bandwith, "wl chanspec ");
system("wl down");
if (system(lynq_cmd_bandwith) != 0 ){
@@ -1011,7 +1043,7 @@
}
case LYNQ_WIFI_BANDWIDTH_HT80:
{
- char lynq_cmd_bandwith[MAX_CMD]="wl chanspec 36/80";
+ char lynq_cmd_bandwith[MAX_CMD]="wl chanspec 149/80";
system("wl down");
if (system(lynq_cmd_bandwith) != 0 ){
return -1;
@@ -1555,6 +1587,9 @@
break;
}
+ if (p == NULL)
+ return -1;
+
ssid = strstr(p, "ssid=");
if (ssid != NULL) {
ssid += strlen("ssid=");
@@ -1604,9 +1639,12 @@
continue;
}
- strcpy(password, p);
+ if (*p == '\"')
+ p++;
+ strncpy(password, p, 64);
- while(*password != '\0') {
+ p = password;
+ while(password - p < 64 && *password != '\0') {
if (*password == '\"') {
*password = '\0';
break;
@@ -2243,8 +2281,14 @@
CHECK_WPA_CTRL(CTRL_STA);
- DO_OK_FAIL_REQUEST(lynq_scan_cmd);
g_sta_scan_finish_flag = 0;
+ DO_REQUEST(lynq_scan_cmd);
+ if (reply_len >=9 && memcmp(cmd_reply, "FAIL-BUSY", 9) == 0 ) {
+ return 0;
+ } else if (reply_len >=2 && memcmp(cmd_reply, "OK", 2) != 0) {
+ g_sta_scan_finish_flag = 1;
+ return -1;
+ }
return 0;
}