WLAN: Pass correct payload while packing management packets.
When sending management frames(Probe rsp, Assoc req/rsp), get
packed packet size after adding all IEs to the frame. So that
correct payload size will be passed, while packing packets.
Change-Id: I91d25fda90f337b987ed20bb924d9f62a8dd82ec
CRs-Fixed: 654880
diff --git a/CORE/MAC/src/pe/lim/limSendManagementFrames.c b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
index d7993e5..f78fc8d 100644
--- a/CORE/MAC/src/pe/lim/limSendManagementFrames.c
+++ b/CORE/MAC/src/pe/lim/limSendManagementFrames.c
@@ -650,7 +650,7 @@
{
tDot11fProbeResponse *pFrm;
tSirRetStatus nSirStatus;
- tANI_U32 cfg, nPayload, nBytes, nStatus;
+ tANI_U32 cfg, nPayload, nStatus;
tpSirMacMgmtHdr pMacHdr;
tANI_U8 *pFrame;
void *pPacket;
@@ -671,6 +671,8 @@
tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
tDot11fIEExtCap extractedExtCap;
tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE;
+ tANI_U32 nBytes = 0;
+
if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests
{
return; // in this case.
@@ -804,27 +806,7 @@
#endif // defined(FEATURE_WLAN_WAPI)
-
- nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
- if ( DOT11F_FAILED( nStatus ) )
- {
- limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
- "or a Probe Response (0x%08x)."),
- nStatus );
- // We'll fall back on the worst case scenario:
- nPayload = sizeof( tDot11fProbeResponse );
- }
- else if ( DOT11F_WARNED( nStatus ) )
- {
- limLog( pMac, LOGW, FL("There were warnings while calculating"
- "the packed size for a Probe Response "
- "(0x%08x)."), nStatus );
- }
-
- nBytes = nPayload + sizeof( tSirMacMgmtHdr );
-
addnIEPresent = false;
-
if( pMac->lim.gpLimRemainOnChanReq )
{
nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) );
@@ -970,6 +952,30 @@
}
}
+ /*merge ExtCap IE*/
+ if (extractedExtCapFlag && extractedExtCap.present)
+ {
+ limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap);
+ }
+
+ nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
+ "or a Probe Response (0x%08x)."),
+ nStatus );
+ // We'll fall back on the worst case scenario:
+ nPayload = sizeof( tDot11fProbeResponse );
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating"
+ "the packed size for a Probe Response "
+ "(0x%08x)."), nStatus );
+ }
+
+ nBytes += nPayload + sizeof( tSirMacMgmtHdr );
+
halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
( tANI_U16 )nBytes, ( void** ) &pFrame,
( void** ) &pPacket );
@@ -1010,11 +1016,6 @@
sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
- /*merge ExtCap IE*/
- if (extractedExtCapFlag)
- {
- limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap);
- }
// That done, pack the Probe Response:
nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr),
nPayload, &nPayload );
@@ -1377,7 +1378,7 @@
tSirRetStatus nSirStatus;
tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
tHalBitVal qosMode, wmeMode;
- tANI_U32 nPayload, nBytes, nStatus;
+ tANI_U32 nPayload, nStatus;
void *pPacket;
eHalStatus halstatus;
tUpdateBeaconParams beaconParams;
@@ -1389,6 +1390,7 @@
tANI_U16 addStripoffIELen = 0;
tDot11fIEExtCap extractedExtCap;
tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE;
+ tANI_U32 nBytes = 0;
#ifdef WLAN_FEATURE_11W
tANI_U32 retryInterval;
@@ -1547,24 +1549,6 @@
limSendBeaconParams(pMac, &beaconParams, psessionEntry );
}
- // Allocate a buffer for this frame:
- nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
- if ( DOT11F_FAILED( nStatus ) )
- {
- limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
- "or an Association Response (0x%08x)."),
- nStatus );
- return;
- }
- else if ( DOT11F_WARNED( nStatus ) )
- {
- limLog( pMac, LOGW, FL("There were warnings while calculating "
- "the packed size for an Association Re"
- "sponse (0x%08x)."), nStatus );
- }
-
- nBytes = sizeof( tSirMacMgmtHdr ) + nPayload;
-
if ( pAssocReq != NULL )
{
if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
@@ -1615,6 +1599,29 @@
}
}
+ /* merge the ExtCap struct*/
+ if (extractedExtCapFlag && extractedExtCap.present)
+ {
+ limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap);
+ }
+
+ nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
+ if ( DOT11F_FAILED( nStatus ) )
+ {
+ limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
+ "or an Association Response (0x%08x)."),
+ nStatus );
+ return;
+ }
+ else if ( DOT11F_WARNED( nStatus ) )
+ {
+ limLog( pMac, LOGW, FL("There were warnings while calculating "
+ "the packed size for an Association Re"
+ "sponse (0x%08x)."), nStatus );
+ }
+
+ nBytes += sizeof( tSirMacMgmtHdr ) + nPayload;
+
halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
( tANI_U16 )nBytes, ( void** ) &pFrame,
( void** ) &pPacket );
@@ -1649,11 +1656,6 @@
sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
- /* merge the ExtCap struct*/
- if (extractedExtCapFlag)
- {
- limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap);
- }
nStatus = dot11fPackAssocResponse( pMac, &frm,
pFrame + sizeof( tSirMacMgmtHdr ),
nPayload, &nPayload );
@@ -2208,7 +2210,7 @@
tANI_U8 *pFrame;
tSirRetStatus nSirStatus;
tLimMlmAssocCnf mlmAssocCnf;
- tANI_U32 nBytes, nPayload, nStatus;
+ tANI_U32 nPayload, nStatus;
tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
void *pPacket;
eHalStatus halstatus;
@@ -2222,6 +2224,7 @@
tpSirMacMgmtHdr pMacHdr;
tDot11fIEExtCap extractedExtCap;
tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE;
+ tANI_U32 nBytes = 0;
if(NULL == psessionEntry)
{
@@ -2445,6 +2448,12 @@
}
#endif
+ /* merge the ExtCap struct*/
+ if (extractedExtCapFlag && extractedExtCap.present)
+ {
+ limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap);
+ }
+
nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload );
if ( DOT11F_FAILED( nStatus ) )
{
@@ -2505,11 +2514,6 @@
vos_mem_free(pFrm);
return;
}
- /* merge the ExtCap struct*/
- if (extractedExtCapFlag)
- {
- limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap);
- }
// That done, pack the Assoc Request:
nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame +