Compare commits

..

9 Commits

Author SHA1 Message Date
Steve Kondik
c54aba9422 qsap: Kill more logspam
Change-Id: I0a32abbf783ffb1534051fd89708d2a49014c6c3
2014-05-13 01:27:12 -07:00
Steve Kondik
b980ab07f5 qsap: Put files in a sane location
* And set their perms

Change-Id: Ifc61a3504433f6b7e1602432ecea70c37785c895
2014-05-11 04:01:05 -07:00
Steve Kondik
6cf22dc84c qsap: Don't log sensitive information
Change-Id: I3ab6d73051d4647941de6eee41c2b5507c5eddc6
2014-05-11 01:36:32 -07:00
Hanumantha Reddy Pothula
f510e31bcd Updated string banned functions strncpy and memcpy
Banned call strncpy has been updated
with strlcpy

Change-Id: I992c2d3580dce24981a4ec9fd9d50ecca109c044
CRs-Fixed: 554334
2014-03-22 04:43:12 +01:00
Mahesh A Saptasagar
b30ed9569f SAP: Make QSAP SDK compatible w.r.t Android framework.
SAP parameter ignore_broadcast_ssid always set to
"broadcast" due to improper handling of SAP parameters
at SAP SDK.

To mitigate this issue update the ignore_broadcast_ssid
parameter based on the value configured in the framework.

Change-Id: Ia1a35a38464710088921b94269b624d8b1910abc
CRs-Fixed: 588560
2014-01-02 21:32:41 +00:00
Mingcheng Zhu
70700a0773 qcom: softap: Fix potential string null termination and buffer overflow
Fix potential string null termination and buffer overflow

Change-Id: I05e28b30a4e3134625d20fb5591b239ea4b9f3a4
CRs-fixed: 554078
2014-01-02 21:32:20 +00:00
Shake M Subhani
5d5650caf1 softap: sscanf sanity check for SoftAP service
The sscanf return value is verified whether the three channel
variables, i.e. start channel, end channel and channel band,
are properly updated. If malformed input is given to sscanf, then
these variables may not properly updated. To provide validation
of input,  verifying that sscanf returned a correct value of 3.

Change-Id: Ibd185e7a0ffcf5803927990531fc33f0e8977cc9
CRs-fixed: 554349
2013-12-06 14:35:34 +01:00
Vinay Krishna Eranna
52fd77178b Fix: SIGPIPE issue while querying softap enabled status
Before downloading commands to driver through softap SDK we are
checking if SoftAP is enabled are not by running ps in popen.
This sometime throws SIGPIPE error (signal) which is not handled,
due to this we were facing application crash. To fix this we modify
to check the operation mode of the driver through ioctl.

Change-Id: Ia0703ff343d401801655d3b666ade66107a4789e
CRs-Fixed: 535340
2013-11-27 01:43:15 +00:00
Mahesh A Saptasagar
fe07ff9ee2 wlan: make qsap compatible w.r.t ndc implementation.
changes to make qsap compatible w.r.t ndc implementation by
correcting argument mismatch.

Change-Id: I6722ce3fdcf2b4bc45c44d82d56f2c5a14435d7c
CRs-Fixed: 436332
2013-11-25 17:48:14 +01:00
6 changed files with 11 additions and 94 deletions

View File

@@ -11,10 +11,10 @@ LOCAL_MODULE := libQWiFiSoftApCfg
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \ LOCAL_C_INCLUDES := $(KERNEL_HEADERS) \
$(JNI_H_INCLUDE) $(JNI_H_INCLUDE)
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_SHARED_LIBRARIES := libsysutils libcutils libnetutils libcrypto LOCAL_SHARED_LIBRARIES := libsysutils libcutils libnetutils libcrypto
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View File

@@ -12,10 +12,6 @@ LOCAL_MODULE_TAGS := optional
LOCAL_CFLAGS += -DSDK_VERSION=\"0.0.1.0\" LOCAL_CFLAGS += -DSDK_VERSION=\"0.0.1.0\"
LOCAL_COPY_HEADERS_TO := sdk/softap/include
LOCAL_COPY_HEADERS := qsap_api.h
LOCAL_COPY_HEADERS += qsap.h
ifdef WIFI_DRIVER_MODULE_PATH ifdef WIFI_DRIVER_MODULE_PATH
LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH=\"$(WIFI_DRIVER_MODULE_PATH)\" LOCAL_CFLAGS += -DWIFI_DRIVER_MODULE_PATH=\"$(WIFI_DRIVER_MODULE_PATH)\"
endif endif

43
softap/sdk/qsap.c Normal file → Executable file
View File

@@ -54,6 +54,7 @@
#include "qsap_api.h" #include "qsap_api.h"
#include "qsap.h" #include "qsap.h"
#include "libwpa_client/wpa_ctrl.h"
#include <sys/system_properties.h> #include <sys/system_properties.h>
@@ -584,45 +585,3 @@ s32 wifi_qsap_reload_softap()
return eSUCCESS; return eSUCCESS;
} }
s32 wifi_qsap_set_tx_power(s32 tx_power)
{
#define QCSAP_IOCTL_SET_MAX_TX_POWER (SIOCIWFIRSTPRIV + 22)
s32 sock;
s32 ret = eERR_SET_TX_POWER;
s8 interface[128];
s8 *iface;
s32 len = 128;
struct iwreq wrq;
if(NULL == (iface = qsap_get_config_value(CONFIG_FILE, &qsap_str[STR_INTERFACE], interface, (u32*)&len))) {
ALOGE("%s :interface error \n", __func__);
return ret;
}
/* Issue QCSAP_IOCTL_SET_MAX_TX_POWER ioctl */
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
ALOGE("%s :socket error \n", __func__);
return eERR_SET_TX_POWER;
}
strlcpy(wrq.ifr_name, iface, sizeof(wrq.ifr_name));
wrq.u.data.length = sizeof(s32);
wrq.u.data.pointer = &tx_power;
wrq.u.data.flags = 0;
ret = ioctl(sock, QCSAP_IOCTL_SET_MAX_TX_POWER, &wrq);
close(sock);
if (ret) {
ALOGE("%s :IOCTL set tx power failed: %ld\n", __func__, ret);
ret = eERR_SET_TX_POWER;
} else {
ALOGD("%s :IOCTL set tx power issued\n", __func__);
ret = eSUCCESS;
}
return ret;
}

View File

@@ -52,8 +52,6 @@ s32 wifi_qsap_start_softap_in_concurrency(void);
s32 wifi_qsap_stop_softap_in_concurrency(void); s32 wifi_qsap_stop_softap_in_concurrency(void);
#endif #endif
s32 wifi_qsap_set_tx_power(s32);
#if __cplusplus #if __cplusplus
}; // extern "C" }; // extern "C"
#endif #endif

View File

@@ -152,7 +152,6 @@ static struct Command cmd_list[eCMD_LAST] = {
{ "setchannelrange", NULL }, { "setchannelrange", NULL },
{ "autochannel", NULL }, { "autochannel", NULL },
{ "ieee80211w", NULL }, { "ieee80211w", NULL },
{ "wpa_key_mgmt", NULL },
}; };
struct Command qsap_str[eSTR_LAST] = { struct Command qsap_str[eSTR_LAST] = {
@@ -1464,7 +1463,6 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
u32 len = MAX_CONF_LINE_LEN; u32 len = MAX_CONF_LINE_LEN;
s8 *pif; s8 *pif;
s8 *pbuf, *pout; s8 *pbuf, *pout;
u32 buflen;
u32 recvLen; u32 recvLen;
u32 tlen; u32 tlen;
@@ -1484,9 +1482,7 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
goto error; goto error;
} }
/* response has length field + 6 bytes per STA */ pbuf = (s8 *)malloc((MAX_STA_ALLOWED * 6) + 8);
buflen = sizeof(u32) + (MAX_STA_ALLOWED * 6);
pbuf = (s8 *)malloc(buflen);
if(NULL == pbuf) { if(NULL == pbuf) {
ALOGE("%s :No memory \n", __func__); ALOGE("%s :No memory \n", __func__);
close(sock); close(sock);
@@ -1496,7 +1492,7 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
#define SIZE_OF_MAC_INT (6) #define SIZE_OF_MAC_INT (6)
strlcpy(wrq.ifr_name, pif, sizeof(wrq.ifr_name)); strlcpy(wrq.ifr_name, pif, sizeof(wrq.ifr_name));
wrq.u.data.length = buflen; wrq.u.data.length = SIZE_OF_MAC_INT * 8 + 8; /** 8 supported MAC and 7 SPACE separators and a '\0' */
wrq.u.data.pointer = (void *)pbuf; wrq.u.data.pointer = (void *)pbuf;
wrq.u.data.flags = 0; wrq.u.data.flags = 0;
@@ -1508,14 +1504,13 @@ void qsap_get_associated_sta_mac(s8 *presp, u32 *plen)
goto error; goto error;
} }
recvLen = *(u32 *)(wrq.u.data.pointer); recvLen = *(unsigned long int *)(wrq.u.data.pointer);
recvLen -= sizeof(u32);
len = qsap_scnprintf(presp, *plen, "%s %s=", SUCCESS, cmd_list[eCMD_ASSOC_STA_MACS].name); len = qsap_scnprintf(presp, *plen, "%s %s=", SUCCESS, cmd_list[eCMD_ASSOC_STA_MACS].name);
pout = presp + len; pout = presp + len;
tlen = *plen - len; tlen = *plen - len;
qsap_mac_to_macstr(pbuf+sizeof(u32), recvLen, pout, &tlen); qsap_mac_to_macstr(pbuf+sizeof(unsigned long int), recvLen, pout, &tlen);
*plen = len + tlen; *plen = len + tlen;
@@ -1717,7 +1712,7 @@ static void qsap_get_from_config(esap_cmd_t cNum, s8 *presp, u32 *plen)
break; break;
case eCMD_REGULATORY_DOMAIN: case eCMD_REGULATORY_DOMAIN:
qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY); qsap_read_cfg(fIni, &qsap_str[STR_802DOT11D_IN_INI], presp, plen, cmd_list[eCMD_REGULATORY_DOMAIN].name, GET_ENABLED_ONLY);
break; break;
case eCMD_RTS_THRESHOLD: case eCMD_RTS_THRESHOLD:
@@ -2306,7 +2301,7 @@ void qsap_disassociate_sta(s8 *pVal, s8 *presp, u32 *plen)
goto end; goto end;
} }
strlcpy(wrq.ifr_name, pif, sizeof(wrq.ifr_name)); strncpy(wrq.ifr_name, pif, sizeof(wrq.ifr_name));
if (TRUE != qsap_get_mac_in_bytes(pVal, (char *) &wrq.u)) { if (TRUE != qsap_get_mac_in_bytes(pVal, (char *) &wrq.u)) {
ALOGE("%s: Invalid input \n", __func__); ALOGE("%s: Invalid input \n", __func__);
@@ -3070,7 +3065,7 @@ int qsapsetSoftap(int argc, char *argv[])
{ {
char cmdbuf[CMD_BUF_LEN]; char cmdbuf[CMD_BUF_LEN];
char respbuf[RECV_BUF_LEN]; char respbuf[RECV_BUF_LEN];
u32 rlen = RECV_BUF_LEN; unsigned long int rlen = RECV_BUF_LEN;
int i; int i;
int hidden = 0; int hidden = 0;
int sec = SEC_MODE_NONE; int sec = SEC_MODE_NONE;
@@ -3182,20 +3177,6 @@ int qsapsetSoftap(int argc, char *argv[])
return 0; return 0;
} }
static int check_for_config_file_size(FILE *fp)
{
int length = 0;
if( NULL != fp )
{
fseek(fp, 0L, SEEK_END);
length = ftell(fp);
}
return length;
}
void check_for_configuration_files(void) void check_for_configuration_files(void)
{ {
FILE * fp; FILE * fp;
@@ -3208,11 +3189,6 @@ void check_for_configuration_files(void)
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH); wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
} }
else { else {
/* The configuration file could be of 0 byte size, replace with default */
if (check_for_config_file_size(fp) <= 0)
wifi_qsap_reset_to_default(CONFIG_FILE, DEFAULT_CONFIG_FILE_PATH);
fclose(fp); fclose(fp);
} }
@@ -3221,11 +3197,6 @@ void check_for_configuration_files(void)
wifi_qsap_reset_to_default(ACCEPT_LIST_FILE, DEFAULT_ACCEPT_LIST_FILE_PATH); wifi_qsap_reset_to_default(ACCEPT_LIST_FILE, DEFAULT_ACCEPT_LIST_FILE_PATH);
} }
else { else {
/* The configuration file could be of 0 byte size, replace with default */
if (check_for_config_file_size(fp) <= 0)
wifi_qsap_reset_to_default(ACCEPT_LIST_FILE, DEFAULT_ACCEPT_LIST_FILE_PATH);
fclose(fp); fclose(fp);
} }
@@ -3234,11 +3205,6 @@ void check_for_configuration_files(void)
wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH); wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH);
} }
else { else {
/* The configuration file could be of 0 byte size, replace with default */
if (check_for_config_file_size(fp) <= 0)
wifi_qsap_reset_to_default(DENY_LIST_FILE, DEFAULT_DENY_LIST_FILE_PATH);
fclose(fp); fclose(fp);
} }

View File

@@ -77,8 +77,7 @@ enum error_val {
eERR_LOAD_FAILED_SDIOIF, eERR_LOAD_FAILED_SDIOIF,
eERR_LOAD_FAILED_SOFTAP, eERR_LOAD_FAILED_SOFTAP,
eERR_SET_CHAN_RANGE, eERR_SET_CHAN_RANGE,
eERR_GET_AUTO_CHAN, eERR_GET_AUTO_CHAN
eERR_SET_TX_POWER
}; };
#ifndef WIFI_DRIVER_CONF_FILE #ifndef WIFI_DRIVER_CONF_FILE
@@ -324,7 +323,6 @@ typedef enum esap_cmd {
eCMD_SET_CHANNEL_RANGE = 62, eCMD_SET_CHANNEL_RANGE = 62,
eCMD_GET_AUTO_CHANNEL = 63, eCMD_GET_AUTO_CHANNEL = 63,
eCMD_IEEE80211W = 64, eCMD_IEEE80211W = 64,
eCMD_WPA_KEY_MGMT = 65,
eCMD_LAST /** New command numbers should be added above this */ eCMD_LAST /** New command numbers should be added above this */
} esap_cmd_t; } esap_cmd_t;