Compare commits

..

34 Commits

Author SHA1 Message Date
Skrilax_CZ
a51136993f Implement wifi_qsap_set_tx_power
Used by radio proprietary binaries from Motorola.

Change-Id: I9fd49cbba6001a4c7ddadf5cb88df06d6146f01a
2015-04-12 21:11:14 +02:00
Steve Kondik
595015ac77 qsap: Kill more logspam
Change-Id: I0a32abbf783ffb1534051fd89708d2a49014c6c3
2015-03-15 00:45:15 -07:00
Steve Kondik
69a004c094 qsap: Put files in a sane location
* And set their perms

Change-Id: Ifc61a3504433f6b7e1602432ecea70c37785c895
2015-03-15 00:45:15 -07:00
Steve Kondik
88df07cb5a qsap: Don't log sensitive information
Change-Id: I3ab6d73051d4647941de6eee41c2b5507c5eddc6
2015-03-15 00:45:15 -07:00
Linux Build Service Account
b8a71a5a88 Merge "wlan: Fix for OSS build compilation issue" 2015-02-12 04:39:25 -08:00
Mahesh A Saptasagar
f31a10d2e2 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
2015-01-11 09:05:15 -08:00
Linux Build Service Account
00e8d69b78 Merge "wlan: Read ieee80211d param from hostapd.conf file" 2014-10-01 02:11:32 -07:00
Vinay Krishna Eranna
c4bcc0d420 wlan: Read ieee80211d param from hostapd.conf file
Read ieee80211d param from hostapd.conf file instead of reading it
from ini file.

Change-Id: I3773652bc91e2f166111704e70231af6845c5ffc
CRs-Fixed: 727043
2014-09-30 01:14:04 -07:00
Linux Build Service Account
005a67d5ca Merge "wlan:ndc command support." 2014-08-02 01:31:51 -07:00
Subhani Shaik
62ada8bd10 wlan:ndc command support.
Copying the softap sdk include files to TARGET obj
so its easy for other modules to include them.
This is required for system/netd/server/Android.mk
file

Change-Id: Ia581cf93b1849866e22ea3f93350906bc4fb8c71
2014-08-01 10:40:56 -07:00
Subhani Shaik
e42000db1a framework: softap enablement through ndc commands.
The softap libraries were missing for the 64bit enablement
through ndc commands. Makefile change required to point to
right kernel include files.

Change-Id: I03cdd609c2fa18f9926de7d67a2c7d5957a81317
2014-07-24 18:01:09 -07:00
Linux Build Service Account
bcc62d3cca Merge "wlan: Add support for configuration of AKM suite" 2014-04-18 01:20:41 -07:00
Linux Build Service Account
45c32d6e64 Merge "framework: Fix for 64-bit unsafe QCSAP_IOCTL_ASSOC_STA_MACADDR handling" 2014-04-08 12:16:34 -07:00
Ravi Joshi
124fb55d96 framework: Fix for 64-bit unsafe QCSAP_IOCTL_ASSOC_STA_MACADDR handling
Fixes for making SAP SDK 64 bit compliant for QCSAP_IOCTL_ASSOC_STA_MACADDR
ioctl

Change-Id: I161ac3113c01752f627bd876f85342d5a9b20ede
CRs-Fixed: 639046
2014-04-02 16:18:12 -07:00
Linux Build Service Account
1e7bd66054 Merge "softap: Fix for hostapd.conf corruption" 2014-03-08 23:37:26 -08:00
Ravi Joshi
8b0be84bab softap: Fix for hostapd.conf corruption
SoftAP fails to load the default hostapd.conf file
which was left behind as part of failed attempt to
start the softAP. The default hostapd.conf is required
to be copied in case of accidental corruption of
hostapd.conf

Change-Id: I4e6ab7a6bc67fcdcfe225e7e1a811fafe402ebc7
CRs-Fixed: 626022
2014-03-07 15:58:23 -08:00
Linux Build Service Account
083d51563a Merge "Updated string banned functions strncpy and memcpy" 2014-01-25 04:21:15 -08:00
Hanumantha Reddy Pothula
87d01a1158 Updated string banned functions strncpy and memcpy
Banned call strncpy has been updated
with strlcpy

Change-Id: I992c2d3580dce24981a4ec9fd9d50ecca109c044
CRs-Fixed: 554334
2014-01-17 11:56:22 +05:30
Linux Build Service Account
e976b492fe Merge "Revert "wlan: Don't overwrite the channel configured in hostapd.conf"" 2014-01-09 15:54:41 -08:00
Linux Build Service Account
0ecf7a3d93 Merge "Revert "wlan: Don't overwrite the channel configured in hostapd.conf"" 2014-01-07 12:04:43 -08:00
Linux Build Service Account
549156b81d Merge "SAP: Make QSAP SDK compatible w.r.t Android framework." 2013-12-18 09:22:59 -08:00
Mahesh A Saptasagar
4a7a459864 Revert "wlan: Don't overwrite the channel configured in hostapd.conf"
This reverts commit 2addd175cc.

Change-Id: I1b4a145bc1b491d65f49dfc0f5990e52de8a4f37
CRs-Fixed: 589261
2013-12-16 13:48:46 +05:30
Mahesh A Saptasagar
d289ef3449 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
2013-12-16 11:50:56 +05:30
Linux Build Service Account
396a3fe49d Merge "wlan: Don't overwrite the channel configured in hostapd.conf" 2013-12-05 09:42:26 -08:00
Mahesh A Saptasagar
2addd175cc wlan: Don't overwrite the channel configured in hostapd.conf
When SAP is turned on through GUI, hostapd.conf file
will be overwritten by the framework parameters.Since
in Kit-Kat framework,channel value is hard coded to 6,
same is getting over written whenever we turn on SAP
through GUI, this will cause SAP to come up always on
channel 6.
To mitigate this issue, avoid overwriting the channel
parameter in hostap.conf file by ignoring the channel
parameter from the framework.

Change-Id: I4d87cf70868ad705f63211b2bd10ac2a67646d09
CRs-Fixed: 584112
2013-12-03 13:32:30 -08:00
Linux Build Service Account
fc7138812d Merge "qcom: softap: Fix potential string null termination and buffer overflow" 2013-11-29 13:30:37 -08:00
Linux Build Service Account
4533339d61 Merge "softap: sscanf sanity check for SoftAP service" 2013-11-26 13:29:20 -08:00
Mingcheng Zhu
69b91cc907 qcom: softap: Fix potential string null termination and buffer overflow
Fix potential string null termination and buffer overflow

Change-Id: I05e28b30a4e3134625d20fb5591b239ea4b9f3a4
CRs-fixed: 554078
2013-11-26 12:23:43 -08:00
Shake M Subhani
ff6440b26f 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-11-26 12:06:14 +05:30
Linux Build Service Account
31088846f0 Merge "wlan: make qsap compatible w.r.t ndc implementation." 2013-11-21 23:15:12 -08:00
Mahesh A Saptasagar
41f17f12e4 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-21 11:27:03 -08:00
Linux Build Service Account
bd4051d8ff Merge "Fix: SIGPIPE issue while querying softap enabled status" 2013-10-18 00:48:18 -07:00
Vinay Krishna Eranna
1c4304379e 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-10-01 20:14:57 +05:30
Chet Lanctot
7a2827f169 wlan: Add support for configuration of AKM suite
Changes to allow setting the configuration item for
AKM suite (wpa_key_mgmt) in hostapd
configuration file.  This is needed for PMF
(802.11w) to add SHA256 to the list when
necessary.

Change-Id: Ia6fd4976241fb11525f4be6c11801b9c471d4427
CRs-Fixed: 523705
2013-09-09 17:48:58 -07:00
6 changed files with 468 additions and 316 deletions

View File

@@ -11,10 +11,10 @@ LOCAL_MODULE := libQWiFiSoftApCfg
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(KERNEL_HEADERS) \ LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
$(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,6 +12,10 @@ 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

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

@@ -54,7 +54,6 @@
#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>
@@ -266,12 +265,12 @@ void qsap_send_module_down_indication(void)
/* Equivalent to: iwpriv wlan0 sendModuleInd */ /* Equivalent to: iwpriv wlan0 sendModuleInd */
if ((s = socket(PF_INET, SOCK_DGRAM, 0)) >= 0) { if ((s = socket(PF_INET, SOCK_DGRAM, 0)) >= 0) {
strncpy(wrq.ifr_name, "wlan0", IFNAMSIZ); strlcpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */ wrq.u.data.length = 0; /* No Set arguments */
wrq.u.mode = 5; /* WE_MODULE_DOWN_IND sub-command */ wrq.u.mode = 5; /* WE_MODULE_DOWN_IND sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 1), &wrq); ret = ioctl(s, (SIOCIWFIRSTPRIV + 1), &wrq);
if (ret < 0 ) { if (ret < 0 ) {
strncpy(wrq.ifr_name, "softap.0", IFNAMSIZ); strlcpy(wrq.ifr_name, "softap.0", IFNAMSIZ);
ret = ioctl(s, (SIOCIWFIRSTPRIV + 1), &wrq); ret = ioctl(s, (SIOCIWFIRSTPRIV + 1), &wrq);
if (ret < 0 ) { if (ret < 0 ) {
ALOGE("ioctl failed: %s", strerror(errno)); ALOGE("ioctl failed: %s", strerror(errno));
@@ -295,7 +294,7 @@ s32 qsap_send_init_ap(void)
/* Equivalent to: iwpriv wlan0 initAP */ /* Equivalent to: iwpriv wlan0 initAP */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
strncpy(wrq.ifr_name, "wlan0", IFNAMSIZ); strlcpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */ wrq.u.data.length = 0; /* No Set arguments */
wrq.u.data.flags = 2; /* WE_INIT_AP sub-command */ wrq.u.data.flags = 2; /* WE_INIT_AP sub-command */
ret = ioctl(s, (SIOCIWFIRSTPRIV + 6), &wrq); ret = ioctl(s, (SIOCIWFIRSTPRIV + 6), &wrq);
@@ -323,7 +322,7 @@ s32 qsap_send_exit_ap(void)
/* Equivalent to: iwpriv wlan0 exitAP */ /* Equivalent to: iwpriv wlan0 exitAP */
if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { if ((s = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) {
strncpy(wrq.ifr_name, "wlan0", IFNAMSIZ); strlcpy(wrq.ifr_name, "wlan0", IFNAMSIZ);
wrq.u.data.length = 0; /* No Set arguments */ wrq.u.data.length = 0; /* No Set arguments */
wrq.u.data.flags = 3; /*WE_EXIT_AP sub-command */ wrq.u.data.flags = 3; /*WE_EXIT_AP sub-command */
@@ -409,7 +408,7 @@ s32 wifi_qsap_stop_bss(void)
return eERR_STOP_BSS; return eERR_STOP_BSS;
} }
strncpy(wrq.ifr_name, iface, sizeof(wrq.ifr_name)); strlcpy(wrq.ifr_name, iface, sizeof(wrq.ifr_name));
wrq.u.data.length = sizeof(cmd); wrq.u.data.length = sizeof(cmd);
wrq.u.data.pointer = cmd; wrq.u.data.pointer = cmd;
wrq.u.data.flags = 0; wrq.u.data.flags = 0;
@@ -434,26 +433,22 @@ s32 wifi_qsap_stop_bss(void)
s32 is_softap_enabled(void) s32 is_softap_enabled(void)
{ {
FILE *fp; s32 mode = 0;
char buf[1024]; int ret;
fp = popen("ps", "r"); ret = qsap_get_mode(&mode);
if (fp == NULL) { if (eSUCCESS != ret) {
ALOGE("Failed to open file"); ALOGD("Failed to get the mode of operation\n");
return eERR_UNKNOWN; return eERR_UNKNOWN;
} }
while (fgets(buf, sizeof(buf)-1, fp) != NULL) { if (mode == IW_MODE_MASTER) {
if(NULL !=(strstr(buf,"hostapd"))) ALOGD("HOSTAPD Enabled\n");
{ return ENABLE;
pclose(fp);
ALOGD("HOSTAPD enabled\n");
return ENABLE;
}
} }
ALOGD("HOSTAPD disabled\n"); ALOGD("HOSTAPD Disabled\n");
pclose(fp);
return DISABLE; return DISABLE;
} }
@@ -589,3 +584,45 @@ 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,6 +52,8 @@ 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

686
softap/sdk/qsap_api.c Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -77,7 +77,8 @@ 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
@@ -98,19 +99,19 @@ enum error_val {
#define DEFAULT_ACCEPT_LIST_FILE_PATH "/system/etc/hostapd/hostapd.accept" #define DEFAULT_ACCEPT_LIST_FILE_PATH "/system/etc/hostapd/hostapd.accept"
/** Accept list file name */ /** Accept list file name */
#define ACCEPT_LIST_FILE "/data/hostapd/hostapd.accept" #define ACCEPT_LIST_FILE "/data/misc/wifi/hostapd.accept"
/** Default Deny list file name */ /** Default Deny list file name */
#define DEFAULT_DENY_LIST_FILE_PATH "/system/etc/hostapd/hostapd.deny" #define DEFAULT_DENY_LIST_FILE_PATH "/system/etc/hostapd/hostapd.deny"
/** Deny list file name */ /** Deny list file name */
#define DENY_LIST_FILE "/data/hostapd/hostapd.deny" #define DENY_LIST_FILE "/data/misc/wifi/hostapd.deny"
/** Default Ini file */ /** Default Ini file */
#define DEFAULT_INI_FILE "/persist/qcom/softap/qcom_cfg_default.ini" #define DEFAULT_INI_FILE "/persist/qcom/softap/qcom_cfg_default.ini"
/** SDK control interface path */ /** SDK control interface path */
#define SDK_CTRL_IF "/data/hostapd/softap_sdk_ctrl" #define SDK_CTRL_IF "/data/misc/wifi/softap_sdk_ctrl"
/** Maximum length of the line in the configuration file */ /** Maximum length of the line in the configuration file */
#define MAX_CONF_LINE_LEN (156) #define MAX_CONF_LINE_LEN (156)
@@ -323,6 +324,7 @@ 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;
@@ -584,6 +586,7 @@ void check_for_configuration_files(void);
void qsap_set_ini_filename(void); void qsap_set_ini_filename(void);
int qsap_set_channel_range(s8 * cmd); int qsap_set_channel_range(s8 * cmd);
int qsap_get_sap_auto_channel_slection(s32 *pautochan); int qsap_get_sap_auto_channel_slection(s32 *pautochan);
int qsap_get_mode(s32 *pmode);
#if __cplusplus #if __cplusplus
}; // extern "C" }; // extern "C"