diff options
author | Rajesh Chauhan <rajeshc@codeaurora.org> | 2014-11-03 16:04:42 -0800 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2014-11-26 01:51:49 +0100 |
commit | ef9e246e800c06b65ef71ffffc0bb7ae946b0d23 (patch) | |
tree | 59a3d5b2b29f956c27effc58bc9aaaae0e0c5cf3 | |
parent | abc9c0f4fe574ee9847f118e5d2ae8c530bac650 (diff) | |
download | android_system_netd-ef9e246e800c06b65ef71ffffc0bb7ae946b0d23.tar.gz android_system_netd-ef9e246e800c06b65ef71ffffc0bb7ae946b0d23.tar.bz2 android_system_netd-ef9e246e800c06b65ef71ffffc0bb7ae946b0d23.zip |
Revert "SOFTAP: Notificate the STA (dis)connect message"
This reverts commit matching change-id:
I4dd0326110c655fcd6cd5f8425be523d9e64ffa7. Due to that change
when security is enforced then STA does not come up after turning
off SoftAP.
Change-Id: I49cd8543192a5cf6617c18f9c7954fdab3952fdb
CRs-Fixed: 750043
-rwxr-xr-x | server/Android.mk | 6 | ||||
-rw-r--r-- | server/CommandListener.cpp | 2 | ||||
-rw-r--r-- | server/ResponseCode.h | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | server/SoftapController.cpp | 105 | ||||
-rw-r--r--[-rwxr-xr-x] | server/SoftapController.h | 13 |
5 files changed, 5 insertions, 122 deletions
diff --git a/server/Android.mk b/server/Android.mk index fc85fa40..cb94bc6c 100755 --- a/server/Android.mk +++ b/server/Android.mk @@ -77,12 +77,6 @@ ifeq ($(BOARD_HAS_QCOM_WLAN), true) LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/sdk/softap/include endif -ifdef WPA_SUPPLICANT_VERSION - LOCAL_CFLAGS += -DLIBWPA_CLIENT_EXISTS - LOCAL_SHARED_LIBRARIES += libwpa_client - LOCAL_C_INCLUDES += external/wpa_supplicant_8/src/common -endif - include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) diff --git a/server/CommandListener.cpp b/server/CommandListener.cpp index e86c22e6..ededddb2 100644 --- a/server/CommandListener.cpp +++ b/server/CommandListener.cpp @@ -248,7 +248,7 @@ CommandListener::CommandListener() : if (!sPppCtrl) sPppCtrl = new PppController(); if (!sSoftapCtrl) - sSoftapCtrl = new SoftapController(this); + sSoftapCtrl = new SoftapController(); if (!sBandwidthCtrl) sBandwidthCtrl = new BandwidthController(); if (!sIdletimerCtrl) diff --git a/server/ResponseCode.h b/server/ResponseCode.h index 9a822011..594d997b 100644 --- a/server/ResponseCode.h +++ b/server/ResponseCode.h @@ -78,6 +78,5 @@ public: static const int InterfaceAddressChange = 614; static const int InterfaceDnsInfo = 615; static const int RouteChange = 616; - static const int InterfaceMessage = 617; }; #endif diff --git a/server/SoftapController.cpp b/server/SoftapController.cpp index 79ce618b..07c77b01 100755..100644 --- a/server/SoftapController.cpp +++ b/server/SoftapController.cpp @@ -42,100 +42,14 @@ #include "SoftapController.h" -#ifdef LIBWPA_CLIENT_EXISTS -#include <dirent.h> -#include "wpa_ctrl.h" -#endif - static const char HOSTAPD_CONF_FILE[] = "/data/misc/wifi/hostapd.conf"; static const char HOSTAPD_BIN_FILE[] = "/system/bin/hostapd"; -#ifdef LIBWPA_CLIENT_EXISTS -static const char HOSTAPD_UNIX_FILE[] = "/data/misc/wifi/hostapd/wlan0"; -static const char HOSTAPD_SOCKETS_DIR[] = "/data/misc/wifi/sockets"; -static const char HOSTAPD_DHCP_DIR[] = "/data/misc/dhcp"; -#endif - -SoftapController::SoftapController(SocketListener *sl) - : mPid(0) { - mSpsl = sl; -} - -SoftapController::~SoftapController() { -} - -#ifdef LIBWPA_CLIENT_EXISTS -void *SoftapController::threadStart(void *obj){ - SoftapController *me = reinterpret_cast<SoftapController *>(obj); - struct wpa_ctrl *ctrl; - int count = 0; - - ALOGE("SoftapController::threadStart..."); - - DIR *dir=NULL; - - dir = opendir(HOSTAPD_SOCKETS_DIR); - if(NULL == dir){ - mkdir(HOSTAPD_SOCKETS_DIR, S_IRWXU|S_IRWXG|S_IRWXO); - chown(HOSTAPD_SOCKETS_DIR, AID_WIFI, AID_WIFI); - }else{ - closedir(dir); - } - - chmod(HOSTAPD_DHCP_DIR, S_IRWXU|S_IRWXG|S_IRWXO); - - ctrl = wpa_ctrl_open(HOSTAPD_UNIX_FILE); - while ( ctrl == NULL ){ - /* - * thread is used to receive sta connected msg from hostapd - * through wap_ctrl interface, when thread is starting up, - * it's possible that hostpd has sta connected to it, so - * decrease sleep time to 10ms to lower the ratio that - * miss the msg from hostapd - */ - usleep(20000); - ctrl = wpa_ctrl_open(HOSTAPD_UNIX_FILE); - if (ctrl != NULL || count >= 150) - break; - count++; - } - if (count == 150 && ctrl == NULL){ - ALOGE("Connection to hostapd Error."); - return NULL; - } - - if (wpa_ctrl_attach(ctrl) !=0 ){ - wpa_ctrl_close(ctrl); - ALOGE("Attach to hostapd Error."); - return NULL; - } - while(me->mHostapdFlag) { - int res = 0; - char buf[256]; - char dest_str[300]; - while (wpa_ctrl_pending(ctrl)) { - size_t len = sizeof(buf) - 1; - res = wpa_ctrl_recv(ctrl, buf, &len); - if (res == 0) { - buf[len] = '\0'; - ALOGD("Get event from hostapd (%s)", buf); - memset(dest_str, 0x0, sizeof(dest_str)); - snprintf(dest_str, sizeof(dest_str), "IfaceMessage active %s", buf); - me->mSpsl->sendBroadcast(ResponseCode::InterfaceMessage, dest_str, false); - }else - break; - } - if(res < 0) - break; - sleep(2); - } +SoftapController::SoftapController() + : mPid(0) {} - wpa_ctrl_detach(ctrl); - wpa_ctrl_close(ctrl); - - return NULL; +SoftapController::~SoftapController() { } -#endif int SoftapController::startSoftap() { pid_t pid = 1; @@ -163,12 +77,6 @@ int SoftapController::startSoftap() { mPid = pid; ALOGD("SoftAP started successfully"); usleep(AP_BSS_START_DELAY); -#ifdef LIBWPA_CLIENT_EXISTS - mHostapdFlag = 1; - if((mThreadErr = pthread_create(&mThread,NULL,SoftapController::threadStart,this)) != 0){ - ALOGE("pthread_create failed for hostapd listen socket (%s)", strerror(errno)); - } -#endif } return ResponseCode::SoftapStatusResult; } @@ -180,13 +88,6 @@ int SoftapController::stopSoftap() { return ResponseCode::SoftapStatusResult; } -#ifdef LIBWPA_CLIENT_EXISTS - mHostapdFlag = 0; - if(mThreadErr == 0){ - pthread_join(mThread, NULL); - } -#endif - ALOGD("Stopping the SoftAP service..."); kill(mPid, SIGTERM); waitpid(mPid, NULL, 0); diff --git a/server/SoftapController.h b/server/SoftapController.h index fd539391..7063067b 100755..100644 --- a/server/SoftapController.h +++ b/server/SoftapController.h @@ -20,8 +20,6 @@ #include <linux/in.h> #include <net/if.h> -#include <sysutils/SocketListener.h> - #define SOFTAP_MAX_BUFFER_SIZE 4096 #define AP_BSS_START_DELAY 200000 #define AP_BSS_STOP_DELAY 500000 @@ -31,7 +29,7 @@ class SoftapController { public: - SoftapController(SocketListener *sl); + SoftapController(); virtual ~SoftapController(); int startSoftap(); @@ -40,17 +38,8 @@ public: int setSoftap(int argc, char *argv[]); int fwReloadSoftap(int argc, char *argv[]); private: - SocketListener *mSpsl; -#ifdef LIBWPA_CLIENT_EXISTS - pthread_t mThread; - int mThreadErr; - int mHostapdFlag; -#endif pid_t mPid; void generatePsk(char *ssid, char *passphrase, char *psk); -#ifdef LIBWPA_CLIENT_EXISTS - static void *threadStart(void *obj); -#endif }; #endif |