summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvamsi <vamsin@qti.qualcomm.com>2013-12-28 20:57:02 +0530
committerPrakash Dhavali <pdhavali@codeaurora.org>2014-01-17 21:45:10 -0800
commitc52ef018a0e35d51891f876850ec852ae657bb2b (patch)
tree55b943020dc2833fdefc24529d8959c92121747e
parent6c45b4a3586e90803266ce28cdb68ca50695d977 (diff)
P2P: Checking for p2p resp action packets properly
added logic to check whether a packet is p2p public action response kind of packet or not. Earlier logic missed to check OUI, OUI_TYPE and action type fields. . Change-Id: I3d4d80c17abb36f41664f754b47a7098db9152b5 CRs-Fixed: 593294
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h9
-rw-r--r--CORE/HDD/src/wlan_hdd_p2p.c74
2 files changed, 53 insertions, 30 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index f73c372e8975..ee07c1e2d1d6 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -162,7 +162,15 @@
#define WLAN_HDD_PUBLIC_ACTION_FRAME 4
#define WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET 24
+#define WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET 24
#define WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET 30
+#define WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET 0
+#define WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET 1
+#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET 2
+#define WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET 5
+#define WLAN_HDD_VENDOR_SPECIFIC_ACTION 0x09
+#define WLAN_HDD_WFA_OUI 0x506F9A
+#define WLAN_HDD_WFA_P2P_OUI_TYPE 0x09
#define WLAN_HDD_P2P_SOCIAL_CHANNELS 3
#define WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN 1
@@ -430,6 +438,7 @@ typedef struct WLAN_WAPI_KEY WLAN_WAPI_KEY;
typedef struct WLAN_WAPI_KEY *pWLAN_WAPI_KEY;
#define WPA_GET_LE16(a) ((u16) (((a)[1] << 8) | (a)[0]))
+#define WPA_GET_BE24(a) ((u32) ( (a[0] << 16) | (a[1] <<8) | a[2]))
#define WLAN_EID_WAPI 68
#define WAPI_PSK_AKM_SUITE 0x02721400
#define WAPI_CERT_AKM_SUITE 0x01721400
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index 1e4a7deded7a..5b59f6c41eaa 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -99,18 +99,42 @@ static void hdd_sendMgmtFrameOverMonitorIface( hdd_adapter_t *pMonAdapter,
tANI_U32 nFrameLength,
tANI_U8* pbFrames,
tANI_U8 frameType );
-#ifdef QCA_WIFI_2_0
-static bool hdd_p2p_is_action_type_rsp( tActionFrmType actionFrmType )
+
+static bool hdd_p2p_is_action_type_rsp( const u8 *buf )
{
- if ( actionFrmType != WLAN_HDD_GO_NEG_REQ &&
- actionFrmType != WLAN_HDD_INVITATION_REQ &&
- actionFrmType != WLAN_HDD_DEV_DIS_REQ &&
- actionFrmType != WLAN_HDD_PROV_DIS_REQ )
- return TRUE;
- else
- return FALSE;
+ tActionFrmType actionFrmType;
+ const u8 *ouiPtr;
+
+ if ( buf[WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET] !=
+ WLAN_HDD_PUBLIC_ACTION_FRAME ) {
+ return VOS_FALSE;
+ }
+
+ if ( buf[WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET] !=
+ WLAN_HDD_VENDOR_SPECIFIC_ACTION ) {
+ return VOS_FALSE;
+ }
+
+ ouiPtr = &buf[WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_OFFSET];
+
+ if ( WPA_GET_BE24(ouiPtr) != WLAN_HDD_WFA_OUI ) {
+ return VOS_FALSE;
+ }
+
+ if ( buf[WLAN_HDD_PUBLIC_ACTION_FRAME_OUI_TYPE_OFFSET] !=
+ WLAN_HDD_WFA_P2P_OUI_TYPE ) {
+ return VOS_FALSE;
+ }
+
+ actionFrmType = buf[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET];
+ if ( actionFrmType != WLAN_HDD_INVITATION_REQ &&
+ actionFrmType != WLAN_HDD_GO_NEG_REQ &&
+ actionFrmType != WLAN_HDD_DEV_DIS_REQ &&
+ actionFrmType != WLAN_HDD_PROV_DIS_REQ )
+ return VOS_TRUE;
+ else
+ return VOS_FALSE;
}
-#endif
eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx,
eHalStatus status )
@@ -129,12 +153,9 @@ eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx,
hddLog( LOG1, "Received remain on channel rsp");
cfgState->remain_on_chan_ctx = NULL;
-#ifdef QCA_WIFI_2_0
+
if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request &&
!pAdapter->internalCancelRemainOnChReq )
-#else
- if( REMAIN_ON_CHANNEL_REQUEST == pRemainChanCtx->rem_on_chan_request )
-#endif
{
if( cfgState->buf )
{
@@ -155,9 +176,7 @@ eHalStatus wlan_hdd_remain_on_channel_callback( tHalHandle hHal, void* pCtx,
#endif
GFP_KERNEL);
}
-#ifdef QCA_WIFI_2_0
pAdapter->internalCancelRemainOnChReq = VOS_FALSE;
-#endif
if ( ( WLAN_HDD_INFRA_STATION == pAdapter->device_mode ) ||
( WLAN_HDD_P2P_CLIENT == pAdapter->device_mode ) ||
@@ -723,28 +742,23 @@ int wlan_hdd_action( struct wiphy *wiphy, struct net_device *dev,
// In case of P2P Client mode if we are already
// on the same channel then send the frame directly
-#ifdef QCA_WIFI_2_0
//For remain on channel we issue a passive scan to firmware
//but currently there is no provision for dynamically extending
//the dwell time therefore cancelling the ongoing remain on channel
//and requesting for new one.
//The below logic will be extended for request type action frames if
//needed in future.
- if ( (type == SIR_MAC_MGMT_FRAME) &&
+ if ((type == SIR_MAC_MGMT_FRAME) &&
(subType == SIR_MAC_MGMT_ACTION) &&
- (buf[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] ==
- WLAN_HDD_PUBLIC_ACTION_FRAME) ) {
- actionFrmType = buf[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET];
- if ( actionFrmType < MAX_P2P_ACTION_FRAME_TYPE &&
- hdd_p2p_is_action_type_rsp(actionFrmType) &&
- cfgState->remain_on_chan_ctx &&
- cfgState->current_freq == chan->center_freq ) {
- status = wlan_hdd_check_remain_on_channel(pAdapter);
- if ( !status )
- pAdapter->internalCancelRemainOnChReq = VOS_TRUE;
- }
+ hdd_p2p_is_action_type_rsp(&buf[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET]) &&
+ cfgState->remain_on_chan_ctx &&
+ cfgState->current_freq == chan->center_freq ) {
+
+ hddLog(LOG1,"action frame: Extending the RoC\n");
+ status = wlan_hdd_check_remain_on_channel(pAdapter);
+ if ( !status )
+ pAdapter->internalCancelRemainOnChReq = VOS_TRUE;
}
-#endif
if((cfgState->remain_on_chan_ctx != NULL) &&
(cfgState->current_freq == chan->center_freq)
)