Compare commits

..

26 Commits

Author SHA1 Message Date
Steve Kondik
fc46d223c6 Merge branch 'LA.BF64.1.2.2_rb4.1' of git://codeaurora.org/platform/system/qcom into caf-merge 2015-10-12 09:53:07 -10:00
Linux Build Service Account
c46bf72725 Merge "Modify NDC commands to write to hostapd.conf" 2015-09-22 20:58:29 -07:00
Linux Build Service Account
bb81a3fc87 Merge "wlan: Add support for 11AC, ACS hostapd config" 2015-09-22 20:58:29 -07:00
Pradeep Reddy POTTETI
a1c6f1dbe5 Provide read/write access on accept/deny files to hostapd
This commit provides read/write access on accept/deny files
to hostapd similar to hostapd.conf.

Change-Id: I1c3cda056a4067d48484cb336e748f04804b68e3
CRs-fixed: 910398
2015-09-18 20:20:16 +05:30
Ashwini Sukhadev Patil
cc16315997 Modify NDC commands to write to hostapd.conf
Provision to configure rts_threshold, fragm_threshold and
wmm_enabled in hostapd.conf through NDC commands.

CRs-Fixed: 889979
Change-Id: I94e4486573b562fbe48c641423bf1c1389d0c744
2015-09-11 19:14:22 +05:30
Manikandan Mohan
e1bfb737ad wlan: Add support for 11AC, ACS hostapd config
Support for configuring 11ac and ACS channel list parameters in
hostapd configuration file through soft AP SDK.

Change-Id: I45c4f4285357701299c44f31243dea5107b0fabb
CRs-Fixed: 892713
2015-09-09 17:38:47 -07:00
Linux Build Service Account
cddacfa293 Merge 650d036038 on remote branch
Change-Id: I622541a7fac02a2db2d869da97a513b062955b4a
2015-08-16 23:56:06 -06:00
c_rrajiv
e629e82bc8 wlan: Add softap support through ndc commands.
Changes required to support the softap commands
through ndc cli. This new support as part of the
64bit enablement and ndc is used for cli automation
in softap testcases.
Change-Id: I460a3785c3b4a44656281c7243ebdf921fe20f91
CRs-Fixed: 710050
2015-07-20 16:39:08 +05:30
Bala Krishna Bhamidipati
650d036038 Invoke qsap_set_ini_filename to set the fIni (if NULL)
If WIFI_DRIVER_CONF_FILE is not defined fIni is set to null and
hence all the set/get_cfg SAP commands fail. Thus, Invoke
qsap_set_ini_filename explicitly if fINI is NULL.

Change-Id: I9df1f95d7f4b884602cc501fe9e75ff4c26e400c
CRs-Fixed: 865432
2015-07-06 15:33:57 +05:30
Changzhi Deng
fddc6bed07 Hotspot: Set maximun client connections number
This function is for end user to set maximun client
connections number and apply this to hostapd module

Change-Id: I6150b376d22756e8c04ebabe666d81cf3af8fc87
2015-06-09 18:23:27 -07:00
Linux Build Service Account
4659de289b Merge "qcom-softap: Replace strcat & strcpy with strlcat & strlcpy" 2015-03-28 09:49:54 -07:00
Naresh Jayaram
71846207cc qcom-softap: Replace strcat & strcpy with strlcat & strlcpy
strcpy and strcat are not safe, instead use strlcpy and strlcat
which have control over the number of bytes to be written to
the output str or buffer.

CRs-Fixed: 802872
Change-Id: I7b6748946633dda551a1015678d41846c19adeb2
2015-03-24 10:28:18 +05:30
Linux Build Service Account
120aeacf0f Merge "Merge d98f57876f on remote branch" 2014-12-09 03:11:03 -08:00
Linux Build Service Account
64f15fc591 Merge d98f57876f on remote branch
Change-Id: I539218e4d40ef020b4913e1540ab8acbf7db1d88
2014-12-08 00:06:00 -07:00
Linux Build Service Account
d98f57876f Merge "framework: Fix for making SAP sdk code 64 bit compliant" 2014-12-06 12:18:56 -08:00
Linux Build Service Account
e9159df711 Merge "Merge 04a6a9712e on remote branch" 2014-12-05 02:45:36 -08:00
Ravi Joshi
5620bb1611 framework: Fix for making SAP sdk code 64 bit compliant
Fix for making SAP SDK code 64 bit compliant. The typedefs
were incorrect on an LP64 architecture since a long int will
be 64-bits.

Change-Id: I4c9f5f2fb2b820193fbe03fdf8e2307c281ea014
CRs-Fixed: 640894
2014-12-04 11:18:00 -08:00
Linux Build Service Account
a9fe9d38bd Merge "wlan: Change location of hostapd files." 2014-12-04 08:27:25 -08:00
Linux Build Service Account
e601816b24 Merge 04a6a9712e on remote branch
Change-Id: Icb0d8a1efb21abd2c03a539c8c2af5a2da39f4f6
2014-12-03 19:36:53 -07:00
Linux Build Service Account
04a6a9712e Merge "framework: Fix for making SAP sdk code 64 bit compliant" 2014-11-30 11:38:37 -08:00
Linux Build Service Account
56710aac73 Merge "wlan: Change location of hostapd files." 2014-11-26 19:20:37 -08:00
Ravi Joshi
9b8ed11141 framework: Fix for making SAP sdk code 64 bit compliant
Fix for making SAP SDK code 64 bit compliant. The typedefs
were incorrect on an LP64 architecture since a long int will
be 64-bits.

Change-Id: I4c9f5f2fb2b820193fbe03fdf8e2307c281ea014
CRs-Fixed: 640894
2014-11-23 22:05:50 -08:00
Linux Build Service Account
92dd0a5d38 Merge "wlan: Fix for OSS build compilation issue" 2014-11-20 07:38:22 -08:00
Linux Build Service Account
f5fecdcc36 Merge "wlan: Change location of hostapd files." 2014-11-20 00:34:55 -08:00
Neelansh Mittal
587b8b3d67 wlan: Change location of hostapd files.
Change location of hostapd accept and deny files
from /data/hostapd to /data/misc/wifi because
SElinux does not allow netd and hostapd to access
/data/hostapd directory.

Change-Id: I61e8521b3a4b6aab759d3b7cbc04acd3da3c8cf3
CRs-Fixed: 756614
2014-11-19 17:59:02 +05:30
Mahesh A Saptasagar
8e9475b346 wlan: Fix for OSS build compilation issue
Do not include "wpa_ctrl.h" in qsap.c file to avoid compilation
errors on OSS builds.

Change-Id: Ie3afa0bc564a5b2d9c2245b85f4681b83c1d1644
CRs-Fixed: 758764
2014-11-18 20:11:25 +05:30
3 changed files with 92 additions and 22 deletions

View File

@@ -319,7 +319,7 @@ JNIEXPORT jstring JNICALL
char code[32] = {0}; char code[32] = {0};
int connect_retry; int connect_retry;
strncpy(cmd, "softap qccmd ", sizeof(cmd)); strlcpy(cmd, "softap qccmd ", sizeof(cmd));
pcmd = (char *) ((*env)->GetStringUTFChars(env, jcmd, NULL)); pcmd = (char *) ((*env)->GetStringUTFChars(env, jcmd, NULL));
@@ -330,12 +330,12 @@ JNIEXPORT jstring JNICALL
ALOGD("Received Command: %s\n", pcmd); ALOGD("Received Command: %s\n", pcmd);
if ((strlen(cmd) + strlen(pcmd)) > sizeof(cmd)) { if ((strlen(cmd) + strlen(pcmd)) >= sizeof(cmd)) {
UPDATE_ERROR_CODE("Command length is larger than MAX_CMD_SIZE", ""); UPDATE_ERROR_CODE("Command length is larger than MAX_CMD_SIZE", "");
goto end; goto end;
} }
strcat(cmd, pcmd); strlcat(cmd, pcmd, sizeof(cmd));
connect_retry = 0; connect_retry = 0;

View File

@@ -153,6 +153,11 @@ static struct Command cmd_list[eCMD_LAST] = {
{ "autochannel", NULL }, { "autochannel", NULL },
{ "ieee80211w", NULL }, { "ieee80211w", NULL },
{ "wpa_key_mgmt", NULL }, { "wpa_key_mgmt", NULL },
{ "max_num_sta", "8" },
{ "ieee80211ac", NULL },
{ "vht_oper_chwidth", NULL },
{ "chanlist", NULL },
{ "ht_capab", NULL },
}; };
struct Command qsap_str[eSTR_LAST] = { struct Command qsap_str[eSTR_LAST] = {
@@ -705,6 +710,40 @@ static s8 *qsap_get_allow_deny_file_name(s8 *pcfgfile, struct Command * pcmd, s8
return NULL; return NULL;
} }
int qsap_hostd_exec(int argc, char ** argv) {
#define MAX_CMD_SIZE 256
char qcCmdBuf[MAX_CMD_SIZE], *pCmdBuf;
u32 len = MAX_CMD_SIZE;
int i = 2, ret;
if ( argc < 4 ) {
ALOGD("failure: invalid arguments");
return -1;
}
argc -= 2;
pCmdBuf = qcCmdBuf;
while (argc--) {
ret = snprintf(pCmdBuf, len, " %s", argv[i]);
if ((ret < 0) || (ret >= (int)len)) {
/* Error case */
/* TODO: Command too long send the error message */
*pCmdBuf = '\0';
break;
}
ALOGD("argv[%d] (%s)",i, argv[i]);
pCmdBuf += ret;
len -= ret;
i++;
}
ALOGD("QCCMD data (%s)", pCmdBuf);
len = MAX_CMD_SIZE;
qsap_hostd_exec_cmd(qcCmdBuf, qcCmdBuf, (u32*)&len);
return 0;
}
/** Function to identify a valid MAC address */ /** Function to identify a valid MAC address */
static int isValid_MAC_address(char *pMac) static int isValid_MAC_address(char *pMac)
{ {
@@ -1713,15 +1752,9 @@ static void qsap_get_from_config(esap_cmd_t cNum, s8 *presp, u32 *plen)
break; break;
case eCMD_FRAG_THRESHOLD: case eCMD_FRAG_THRESHOLD:
qsap_read_cfg(fIni, &qsap_str[STR_FRAG_THRESHOLD_IN_INI], presp, plen, cmd_list[eCMD_FRAG_THRESHOLD].name, GET_ENABLED_ONLY);
break;
case eCMD_REGULATORY_DOMAIN: case eCMD_REGULATORY_DOMAIN:
qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY);
break;
case eCMD_RTS_THRESHOLD: case eCMD_RTS_THRESHOLD:
qsap_read_cfg(fIni, &qsap_str[STR_RTS_THRESHOLD_IN_INI], presp, plen, cmd_list[eCMD_RTS_THRESHOLD].name, GET_ENABLED_ONLY); qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY);
break; break;
case eCMD_ALLOW_LIST: /* fall through */ case eCMD_ALLOW_LIST: /* fall through */
@@ -1740,7 +1773,7 @@ static void qsap_get_from_config(esap_cmd_t cNum, s8 *presp, u32 *plen)
break; break;
case eCMD_WMM_STATE: case eCMD_WMM_STATE:
qsap_read_cfg(fIni, &qsap_str[STR_WMM_IN_INI], presp, plen, cmd_list[eCMD_WMM_STATE].name, GET_ENABLED_ONLY); qsap_read_cfg(pconffile, &cmd_list[cNum], presp, plen, NULL, GET_ENABLED_ONLY);
break; break;
case eCMD_WPS_STATE: case eCMD_WPS_STATE:
@@ -2610,6 +2643,9 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
goto error; goto error;
break; break;
case eCMD_SET_MAX_CLIENTS:
value = strlen(pVal);
break;
case eCMD_BSSID: case eCMD_BSSID:
value = atoi(pVal); value = atoi(pVal);
if(FALSE == IS_VALID_BSSID(value)) if(FALSE == IS_VALID_BSSID(value))
@@ -2872,8 +2908,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
goto error; goto error;
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value); qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
cNum = STR_WMM_IN_INI;
ini = INI_CONF_FILE;
break; break;
case eCMD_WPS_STATE: case eCMD_WPS_STATE:
value = atoi(pVal); value = atoi(pVal);
@@ -2904,9 +2938,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
if(TRUE != IS_VALID_FRAG_THRESHOLD(value)) if(TRUE != IS_VALID_FRAG_THRESHOLD(value))
goto error; goto error;
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value); qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
cNum = STR_FRAG_THRESHOLD_IN_INI;
ini = INI_CONF_FILE;
break; break;
case eCMD_REGULATORY_DOMAIN: case eCMD_REGULATORY_DOMAIN:
@@ -2923,8 +2954,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
if(TRUE != IS_VALID_RTS_THRESHOLD(value)) if(TRUE != IS_VALID_RTS_THRESHOLD(value))
goto error; goto error;
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value); qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
cNum = STR_RTS_THRESHOLD_IN_INI;
ini = INI_CONF_FILE;
break; break;
case eCMD_GTK_TIMEOUT: case eCMD_GTK_TIMEOUT:
@@ -2938,7 +2967,6 @@ static void qsap_handle_set_request(s8 *pcmd, s8 *presp, u32 *plen)
value = atoi(pVal); value = atoi(pVal);
if(TRUE != IS_VALID_TX_POWER(value)) if(TRUE != IS_VALID_TX_POWER(value))
goto error; goto error;
qsap_set_ini_filename();
qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value); qsap_scnprintf(pVal, strlen(pVal)+1, "%ld", value);
cNum = STR_TX_POWER_IN_INI; cNum = STR_TX_POWER_IN_INI;
ini = INI_CONF_FILE; ini = INI_CONF_FILE;
@@ -3033,6 +3061,8 @@ void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen)
SKIP_BLANK_SPACE(pcmd); SKIP_BLANK_SPACE(pcmd);
check_for_configuration_files(); check_for_configuration_files();
if(fIni == NULL)
qsap_set_ini_filename();
if(!strncmp(pcmd, Cmd_req[eCMD_GET], strlen(Cmd_req[eCMD_GET])) && isblank(pcmd[strlen(Cmd_req[eCMD_GET])])) { if(!strncmp(pcmd, Cmd_req[eCMD_GET], strlen(Cmd_req[eCMD_GET])) && isblank(pcmd[strlen(Cmd_req[eCMD_GET])])) {
qsap_handle_get_request(pcmd, presp, plen); qsap_handle_get_request(pcmd, presp, plen);
@@ -3168,6 +3198,16 @@ int qsapsetSoftap(int argc, char *argv[])
return -1; return -1;
} }
rlen = RECV_BUF_LEN;
if(argc > 8) {
qsap_scnprintf(cmdbuf, sizeof(cmdbuf), "set max_num_sta=%d",atoi(argv[8]));
}
(void) qsap_hostd_exec_cmd(cmdbuf, respbuf, &rlen);
if(strncmp("success", respbuf, rlen) != 0) {
ALOGE("Failed to set maximun client connections number \n");
return -1;
}
rlen = RECV_BUF_LEN; rlen = RECV_BUF_LEN;
qsap_scnprintf(cmdbuf, sizeof(cmdbuf), "set commit"); qsap_scnprintf(cmdbuf, sizeof(cmdbuf), "set commit");
@@ -3199,9 +3239,9 @@ static int check_for_config_file_size(FILE *fp)
void check_for_configuration_files(void) void check_for_configuration_files(void)
{ {
FILE * fp; FILE * fp;
char *pfile;
/* Check if configuration files are present, if not create the default files */ /* Check if configuration files are present, if not create the default files */
mkdir("/data/hostapd", 0771);
/* If configuration file does not exist copy the default file */ /* If configuration file does not exist copy the default file */
if ( NULL == (fp = fopen(CONFIG_FILE, "r")) ) { if ( NULL == (fp = fopen(CONFIG_FILE, "r")) ) {
@@ -3229,6 +3269,18 @@ void check_for_configuration_files(void)
fclose(fp); fclose(fp);
} }
/* Provide read and write permissions to the owner */
pfile = ACCEPT_LIST_FILE;
if (chmod(pfile, 0660) < 0) {
ALOGE("Error changing permissions of %s to 0660: %s",
pfile, strerror(errno));
}
if (chown(pfile, AID_SYSTEM, AID_WIFI) < 0) {
ALOGE("Error changing group ownership of %s to %d: %s",
pfile, AID_WIFI, strerror(errno));
}
/* If deny MAC list file does not exist, copy the default file */ /* If deny MAC list file does not exist, copy the default file */
if ( NULL == (fp = fopen(DENY_LIST_FILE, "r")) ) { if ( NULL == (fp = fopen(DENY_LIST_FILE, "r")) ) {
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);
@@ -3242,6 +3294,18 @@ void check_for_configuration_files(void)
fclose(fp); fclose(fp);
} }
/* Provide read and write permissions to the owner */
pfile = DENY_LIST_FILE;
if (chmod(pfile, 0660) < 0) {
ALOGE("Error changing permissions of %s to 0660: %s",
pfile, strerror(errno));
}
if (chown(pfile, AID_SYSTEM, AID_WIFI) < 0) {
ALOGE("Error changing group ownership of %s to %d: %s",
pfile, AID_WIFI, strerror(errno));
}
return; return;
} }

View File

@@ -39,8 +39,8 @@ typedef unsigned char u8;
typedef char s8; typedef char s8;
typedef unsigned short int u16; typedef unsigned short int u16;
typedef signed short int s16; typedef signed short int s16;
typedef unsigned long int u32; typedef unsigned int u32;
typedef signed long int s32; typedef signed int s32;
/** Success and error messages */ /** Success and error messages */
#define SUCCESS "success" #define SUCCESS "success"
@@ -325,6 +325,11 @@ typedef enum esap_cmd {
eCMD_GET_AUTO_CHANNEL = 63, eCMD_GET_AUTO_CHANNEL = 63,
eCMD_IEEE80211W = 64, eCMD_IEEE80211W = 64,
eCMD_WPA_KEY_MGMT = 65, eCMD_WPA_KEY_MGMT = 65,
eCMD_SET_MAX_CLIENTS = 66,
eCMD_IEEE80211AC = 67,
eCMD_VHT_OPER_CH_WIDTH = 68,
eCMD_ACS_CHAN_LIST = 69,
eCMD_HT_CAPAB = 70,
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;
@@ -577,6 +582,7 @@ typedef struct sap_auto_channel_info {
#define IS_VALID_ENERGY_DETECT_TH(x) ((((x >= AP_ENERGY_DETECT_TH_MIN) && (x <= AP_ENERGY_DETECT_TH_MAX)) ||( x == 128)) ? TRUE : FALSE) #define IS_VALID_ENERGY_DETECT_TH(x) ((((x >= AP_ENERGY_DETECT_TH_MIN) && (x <= AP_ENERGY_DETECT_TH_MAX)) ||( x == 128)) ? TRUE : FALSE)
/** Function declartion */ /** Function declartion */
int qsap_hostd_exec(int argc, char ** argv);
void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen); void qsap_hostd_exec_cmd(s8 *pcmd, s8 *presp, u32 *plen);
s8 *qsap_get_config_value(s8 *pfile, struct Command *pcmd, s8 *pbuf, u32 *plen); s8 *qsap_get_config_value(s8 *pfile, struct Command *pcmd, s8 *pbuf, u32 *plen);
int qsapsetSoftap(int argc, char *argv[]); int qsapsetSoftap(int argc, char *argv[]);