rtl8188eu: Fix more endian issues

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-02-16 13:00:49 -06:00
parent b3e44458db
commit 276a62340a
5 changed files with 64 additions and 62 deletions

View file

@ -6692,17 +6692,17 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short
unsigned char *pframe; unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr; struct rtw_ieee80211_hdr *pwlanhdr;
__le16 *fctrl; __le16 *fctrl;
__le32 val32; unsigned int val32;
__le16 val16; u16 val16;
__le16 le_val16;
int use_shared_key = 0; int use_shared_key = 0;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) pmgntframe = alloc_mgtxmitframe(pxmitpriv);
{ if (pmgntframe == NULL)
return; return;
}
//update attribute //update attribute
pattrib = &pmgntframe->attrib; pattrib = &pmgntframe->attrib;
@ -6724,69 +6724,72 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
if(psta)// for AP mode if(psta) { // for AP mode
{
#ifdef CONFIG_NATIVEAP_MLME #ifdef CONFIG_NATIVEAP_MLME
memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN); memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
_rtw_memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN);
// setting auth algo number // setting auth algo number
val16 = cpu_to_le16((u16)psta->authalg); val16 = (u16)psta->authalg;
if(status != _STATS_SUCCESSFUL_) if(status != _STATS_SUCCESSFUL_)
val16 = 0; val16 = 0;
if (val16) if (val16) {
le_val16 = cpu_to_le16(val16);
use_shared_key = 1; use_shared_key = 1;
} else {
pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); le_val16 = 0;
}
pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen));
// setting auth seq number // setting auth seq number
val16 =cpu_to_le16((u16)psta->auth_seq); val16 =(u16)psta->auth_seq;
pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); le_val16 = cpu_to_le16(val16);
pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen));
// setting status code... // setting status code...
val16 = cpu_to_le16(status); val16 = status;
pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen)); le_val16 = cpu_to_le16(val16);
pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&le_val16, &(pattrib->pktlen));
// added challenging text... // added challenging text...
if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1)) if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1))
pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen)); pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen));
#endif #endif
} else { } else {
_rtw_memcpy(pwlanhdr->addr1, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); __le32 le_tmp32;
_rtw_memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN); __le16 le_tmp16;
_rtw_memcpy(pwlanhdr->addr3, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); memcpy(pwlanhdr->addr1, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
memcpy(pwlanhdr->addr2, myid(&padapter->eeprompriv), ETH_ALEN);
memcpy(pwlanhdr->addr3, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
// setting auth algo number // setting auth algo number
val16 = cpu_to_le16((pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared)? 1: 0);// 0:OPEN System, 1:Shared key val16 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) ? 1 : 0;/* 0:OPEN System, 1:Shared key */
if (val16) if (val16)
use_shared_key = 1; use_shared_key = 1;
//DBG_871X("%s auth_algo= %s auth_seq=%d\n",__FUNCTION__,(pmlmeinfo->auth_algo==0)?"OPEN":"SHARED",pmlmeinfo->auth_seq); /* setting IV for auth seq #3 */
if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) {
//setting IV for auth seq #3 val32 = ((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30));
if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1)) le_tmp32 = cpu_to_le32(val32);
{ pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&le_tmp32, &(pattrib->pktlen));
//DBG_871X("==> iv(%d),key_index(%d)\n",pmlmeinfo->iv,pmlmeinfo->key_index);
val32 = cpu_to_le32((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30));
pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&val32, &(pattrib->pktlen));
pattrib->iv_len = 4; pattrib->iv_len = 4;
} }
pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); le_tmp16 = cpu_to_le16(val16);
pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&le_tmp16, &(pattrib->pktlen));
// setting auth seq number /* setting auth seq number */
val16 = cpu_to_le16(pmlmeinfo->auth_seq); val16 = pmlmeinfo->auth_seq;
pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); le_tmp16 = cpu_to_le16(val16);
pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&le_tmp16, &(pattrib->pktlen));
/* setting status code... */
// setting status code... le_tmp16 = cpu_to_le16(status);
val16 = cpu_to_le16(status); pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&le_tmp16, &(pattrib->pktlen));
pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen));
// then checking to see if sending challenging text... // then checking to see if sending challenging text...
if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1)) { if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key==1)) {
@ -6820,15 +6823,15 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
struct rtw_ieee80211_hdr *pwlanhdr; struct rtw_ieee80211_hdr *pwlanhdr;
struct pkt_attrib *pattrib; struct pkt_attrib *pattrib;
unsigned char *pbuf, *pframe; unsigned char *pbuf, *pframe;
__le16 val; u16 val;
__le16 *fctrl; __le16 *fctrl;
__le16 le_status;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network); WLAN_BSSID_EX *pnetwork = &(pmlmeinfo->network);
u8 *ie = pnetwork->IEs; u8 *ie = pnetwork->IEs;
__le16 lestatus, leval;
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo); struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#ifdef CONFIG_WFD #ifdef CONFIG_WFD
@ -6839,17 +6842,16 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
DBG_871X("%s\n", __FUNCTION__); DBG_871X("%s\n", __FUNCTION__);
if ((pmgntframe = alloc_mgtxmitframe(pxmitpriv)) == NULL) pmgntframe = alloc_mgtxmitframe(pxmitpriv);
{ if (pmgntframe == NULL)
return; return;
}
//update attribute /* update attribute */
pattrib = &pmgntframe->attrib; pattrib = &pmgntframe->attrib;
update_mgntframe_attrib(padapter, pattrib); update_mgntframe_attrib(padapter, pattrib);
_rtw_memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET; pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
@ -6857,9 +6859,9 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
fctrl = &(pwlanhdr->frame_ctl); fctrl = &(pwlanhdr->frame_ctl);
*(fctrl) = 0; *(fctrl) = 0;
_rtw_memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN); memcpy((void *)GetAddr1Ptr(pwlanhdr), pstat->hwaddr, ETH_ALEN);
_rtw_memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN); memcpy((void *)GetAddr2Ptr(pwlanhdr), myid(&(padapter->eeprompriv)), ETH_ALEN);
_rtw_memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); memcpy((void *)GetAddr3Ptr(pwlanhdr), get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN);
SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq);
@ -6873,16 +6875,16 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
pattrib->pktlen += pattrib->hdrlen; pattrib->pktlen += pattrib->hdrlen;
pframe += pattrib->hdrlen; pframe += pattrib->hdrlen;
//capability /* capability */
val = *(__le16 *)rtw_get_capability_from_ie(ie); val = *(unsigned short *)rtw_get_capability_from_ie(ie);
pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, &(pattrib->pktlen));
le_status = cpu_to_le16(status); lestatus = cpu_to_le16(status);
pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&le_status, &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&lestatus, &(pattrib->pktlen));
val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15)); leval = cpu_to_le16(pstat->aid | BIT(14) | BIT(15));
pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&val, &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&leval, &(pattrib->pktlen));
if (pstat->bssratelen <= 8) { if (pstat->bssratelen <= 8) {
pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen)); pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen));

View file

@ -571,7 +571,7 @@ static void ConstructARPResponse(
struct security_priv *psecuritypriv = &padapter->securitypriv; struct security_priv *psecuritypriv = &padapter->securitypriv;
static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06}; static u8 ARPLLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x08, 0x06};
u16 *fctrl; __le16 *fctrl;
u32 pktlen; u32 pktlen;
u8 *pARPRspPkt = pframe; u8 *pARPRspPkt = pframe;
//for TKIP Cal MIC //for TKIP Cal MIC

View file

@ -259,7 +259,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
u16 wvalue; u16 wvalue;
u16 index; u16 index;
u16 len; u16 len;
__le16 data; __le32 data;
int ret; int ret;
request = 0x05; request = 0x05;
@ -269,7 +269,7 @@ static int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val)
wvalue = (u16)(addr&0x0000ffff); wvalue = (u16)(addr&0x0000ffff);
len = 2; len = 2;
data = cpu_to_le16(val); data = cpu_to_le32(val & 0x0000ffff);
ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); ret = usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype);

View file

@ -620,7 +620,7 @@ struct rtw_ieee80211_ht_cap {
u8 ampdu_params_info; u8 ampdu_params_info;
u8 supp_mcs_set[16]; u8 supp_mcs_set[16];
__le16 extended_ht_cap_info; __le16 extended_ht_cap_info;
__le32 tx_BF_cap_info; __le16 tx_BF_cap_info;
u8 antenna_selection_info; u8 antenna_selection_info;
} __attribute__ ((packed)); } __attribute__ ((packed));

View file

@ -1829,7 +1829,7 @@ static int rtw_wx_set_mlme(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
int ret=0; int ret=0;
__le16 reason; u16 reason;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev);
struct iw_mlme *mlme = (struct iw_mlme *) extra; struct iw_mlme *mlme = (struct iw_mlme *) extra;
@ -1839,7 +1839,7 @@ static int rtw_wx_set_mlme(struct net_device *dev,
DBG_871X("%s\n", __FUNCTION__); DBG_871X("%s\n", __FUNCTION__);
reason = cpu_to_le16(mlme->reason_code); reason = mlme->reason_code;
DBG_871X("%s, cmd=%d, reason=%d\n", __FUNCTION__, mlme->cmd, reason); DBG_871X("%s, cmd=%d, reason=%d\n", __FUNCTION__, mlme->cmd, reason);