Fixed logic errors in GetGroupAddress and SetGroupAddress functions.
This commit is contained in:
parent
34dce0f2b1
commit
d654be6f5a
|
@ -293,12 +293,12 @@ Configuration RIDs: Network Parameters, Dynamic Configuration Entities
|
|||
/*--------------------------------------------------------------------
|
||||
Configuration RID Lengths: Network Param, Dynamic Config Entities
|
||||
--------------------------------------------------------------------*/
|
||||
#define HFA384x_RID_GROUPADDR_LEN (6)
|
||||
#define HFA384x_RID_GROUPADDR_LEN (16 * WLAN_ADDR_LEN)
|
||||
#define HFA384x_RID_CREATEIBSS_LEN (0)
|
||||
#define HFA384x_RID_FRAGTHRESH_LEN (0)
|
||||
#define HFA384x_RID_RTSTHRESH_LEN (0)
|
||||
#define HFA384x_RID_TXRATECNTL_LEN (4)
|
||||
#define HFA384x_RID_PROMISCMODE_LEN (0)
|
||||
#define HFA384x_RID_PROMISCMODE_LEN (2)
|
||||
#define HFA384x_RID_FRAGTHRESH0_LEN (0)
|
||||
#define HFA384x_RID_FRAGTHRESH1_LEN (0)
|
||||
#define HFA384x_RID_FRAGTHRESH2_LEN (0)
|
||||
|
|
|
@ -158,7 +158,7 @@ void prism2mgmt_SetOperationalRateSet(UINT16 *rate, p80211pstrd_t *pstr);
|
|||
|
||||
/* functions to convert Group Addresses */
|
||||
void prism2mgmt_GetGroupAddress(UINT32 did, p80211pstrd_t *pstr, prism2sta_priv_t *priv );
|
||||
void prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
|
||||
int prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
|
||||
p80211pstrd_t *pstr, prism2sta_priv_t *priv );
|
||||
int GetGroupAddressIndex( UINT32 did );
|
||||
|
||||
|
|
|
@ -553,10 +553,36 @@ int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
|
|||
prism2mgmt_GetGroupAddress(mibitem->did,
|
||||
pstr, priv );
|
||||
} else {
|
||||
prism2mgmt_SetGroupAddress(mibitem->did, bytebuf,
|
||||
pstr, priv );
|
||||
result = hfa384x_drvr_setconfig( hw, HFA384x_RID_GROUPADDR,
|
||||
bytebuf, HFA384x_RID_GROUPADDR_LEN);
|
||||
if (result = prism2mgmt_SetGroupAddress(mibitem->did, bytebuf,
|
||||
pstr, priv ) == 0 ) {
|
||||
if ( (priv->cnt) <= 16 ) {
|
||||
memcpy( bytebuf,
|
||||
priv->GroupAddresses[0],
|
||||
((priv->grpcnt) * WLAN_ADDR_LEN));
|
||||
result = hfa384x_drvr_setconfig( hw,
|
||||
HFA384x_RID_GROUPADDR,
|
||||
bytebuf,
|
||||
((priv->grpcnt) * WLAN_ADDR_LEN));
|
||||
} else {
|
||||
/* clear group addresses in card
|
||||
and set to promiscuous mode */
|
||||
memset( bytebuf, 0,
|
||||
((priv->grpcnt) * WLAN_ADDR_LEN));
|
||||
result = hfa384x_drvr_setconfig( hw,
|
||||
HFA384x_RID_GROUPADDR,
|
||||
bytebuf, 0);
|
||||
if ( result == 0 )
|
||||
{
|
||||
*wordbuf = 1;
|
||||
result = hfa384x_drvr_setconfig16( hw,
|
||||
HFA384x_RID_PROMISCMODE,
|
||||
wordbuf);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
msg->resultcode.data = P80211ENUM_resultcode_not_supported;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType:
|
||||
|
@ -1212,44 +1238,6 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp)
|
|||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* prism2mgmt_readpda
|
||||
*
|
||||
* Collect the PDA data and put it in the message.
|
||||
*
|
||||
* Arguments:
|
||||
* wlandev wlan device structure
|
||||
* msgp ptr to msg buffer
|
||||
*
|
||||
* Returns:
|
||||
* 0 success and done
|
||||
* <0 success, but we're waiting for something to finish.
|
||||
* >0 an error occurred while handling the message.
|
||||
* Side effects:
|
||||
*
|
||||
* Call context:
|
||||
* process thread (usually)
|
||||
----------------------------------------------------------------*/
|
||||
int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp)
|
||||
{
|
||||
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
|
||||
p80211msg_p2req_readpda_t *msg = msgp;
|
||||
DBFENTER;
|
||||
|
||||
/* This driver really shouldn't be active if we weren't able */
|
||||
/* to read a PDA from a card. Therefore, we assume the pda */
|
||||
/* in priv->pda is good. */
|
||||
memcpy( msg->pda.data, priv->pda, HFA384x_PDA_LEN_MAX);
|
||||
msg->pda.status = P80211ENUM_msgitem_status_data_ok;
|
||||
|
||||
msg->resultcode.data = P80211ENUM_resultcode_success;
|
||||
msg->resultcode.status = P80211ENUM_msgitem_status_data_ok;
|
||||
|
||||
DBFEXIT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* prism2mgmt_wlansniff
|
||||
*
|
||||
|
@ -1627,46 +1615,65 @@ void prism2mgmt_GetGroupAddress(UINT32 did, p80211pstrd_t *pstr,
|
|||
* groups
|
||||
*
|
||||
* Returns:
|
||||
* Nothing
|
||||
* 0 Success
|
||||
* !0 Error
|
||||
*
|
||||
----------------------------------------------------------------*/
|
||||
void prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
|
||||
int prism2mgmt_SetGroupAddress(UINT32 did, UINT8 *prism2buf,
|
||||
p80211pstrd_t *pstr, prism2sta_priv_t *priv )
|
||||
{
|
||||
UINT8 no_addr[WLAN_ADDR_LEN];
|
||||
int i;
|
||||
int index;
|
||||
int result;
|
||||
|
||||
memset(no_addr, 0, WLAN_ADDR_LEN);
|
||||
result = 0;
|
||||
|
||||
/* here we're "adding" an address to the group
|
||||
address list. Check to make sure we aren't
|
||||
trying to add more than the maximum allowed
|
||||
number of group addresses in the list */
|
||||
if ( memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) {
|
||||
for ( i = 0; i < priv->grpcnt; i++ ) {
|
||||
if ( memcmp(priv->GroupAddresses[i], pstr->data, WLAN_ADDR_LEN) != 0) {
|
||||
memcpy( priv->GroupAddresses[i],
|
||||
pstr->data,
|
||||
WLAN_ADDR_LEN);
|
||||
}
|
||||
}
|
||||
priv->grpcnt += 1;
|
||||
} else {
|
||||
index = GetGroupAddressIndex(did);
|
||||
|
||||
if ( index >= 0 ) {
|
||||
priv->grpcnt -= 1;
|
||||
/* shift all the addresses following
|
||||
the one to delete */
|
||||
memcpy( priv->GroupAddresses[index],
|
||||
priv->GroupAddresses[index + 1],
|
||||
((priv->grpcnt)-index) * WLAN_ADDR_LEN);
|
||||
/* erase the last address that now appears
|
||||
twice */
|
||||
if ( priv->grpcnt < MAX ) {
|
||||
memcpy( priv->GroupAddresses[priv->grpcnt],
|
||||
no_addr, WLAN_ADDR_LEN);
|
||||
pstr->data, WLAN_ADDR_LEN);
|
||||
priv->grpcnt += 1;
|
||||
} else {
|
||||
result = -1;
|
||||
}
|
||||
} else {
|
||||
/* here we're "deleting" an address from the
|
||||
group address list. Check to make sure we're
|
||||
not trying to delete from an empty list */
|
||||
if ( priv->grpcnt > 0 ) {
|
||||
index = GetGroupAddressIndex(did);
|
||||
|
||||
if ( index >= 0 ) {
|
||||
/* check to make sure there is an address
|
||||
to delete at the requested group address */
|
||||
if ( memcmp(priv->GroupAddresses[index],
|
||||
no_addr,
|
||||
WLAN_ADDR_LEN) != 0) {
|
||||
priv->grpcnt -= 1;
|
||||
/* shift all the addresses following
|
||||
the one to delete */
|
||||
memcpy( priv->GroupAddresses[index],
|
||||
priv->GroupAddresses[index + 1],
|
||||
((priv->grpcnt)-index) * WLAN_ADDR_LEN);
|
||||
/* erase the last address that now appears
|
||||
twice */
|
||||
memcpy( priv->GroupAddresses[priv->grpcnt],
|
||||
no_addr,
|
||||
WLAN_ADDR_LEN);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = -1;
|
||||
}
|
||||
}
|
||||
memcpy( prism2buf, priv->GroupAddresses[0],
|
||||
(16 * WLAN_ADDR_LEN));
|
||||
return;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue