mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-06-23 08:34:20 +00:00
rtl8188eu: Remove wrapper around memcmp()
Caution: The wrapper inverts the state. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
24391e61f4
commit
89efde68f8
17 changed files with 137 additions and 149 deletions
|
@ -416,8 +416,8 @@ static void _mgt_dispatcher(struct adapter *padapter, struct mlme_handler *ptabl
|
|||
|
||||
if (ptable->func) {
|
||||
/* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
|
||||
if (!_rtw_memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
|
||||
!_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN))
|
||||
if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
|
||||
memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN))
|
||||
return;
|
||||
ptable->func(padapter, precv_frame);
|
||||
}
|
||||
|
@ -444,8 +444,8 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
}
|
||||
|
||||
/* receive the frames that ra(a1) is my address or ra(a1) is bc address. */
|
||||
if (!_rtw_memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
|
||||
!_rtw_memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN))
|
||||
if (memcmp(GetAddr1Ptr(pframe), myid(&padapter->eeprompriv), ETH_ALEN) &&
|
||||
memcmp(GetAddr1Ptr(pframe), bc_addr, ETH_ALEN))
|
||||
return;
|
||||
|
||||
ptable = mlme_sta_tbl;
|
||||
|
@ -590,7 +590,7 @@ _continue:
|
|||
if (is_valid_p2p_probereq)
|
||||
goto _issue_probersp;
|
||||
|
||||
if ((ielen != 0 && !_rtw_memcmp((void *)(p+2), (void *)cur->Ssid.Ssid, cur->Ssid.SsidLength)) ||
|
||||
if ((ielen != 0 && memcmp((void *)(p+2), (void *)cur->Ssid.Ssid, cur->Ssid.SsidLength)) ||
|
||||
(ielen == 0 && pmlmeinfo->hidden_ssid_mode))
|
||||
return _SUCCESS;
|
||||
|
||||
|
@ -615,7 +615,7 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
#ifdef CONFIG_88EU_P2P
|
||||
if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) {
|
||||
if (pwdinfo->tx_prov_disc_info.benable) {
|
||||
if (_rtw_memcmp(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr2Ptr(pframe), ETH_ALEN)) {
|
||||
if (!memcmp(pwdinfo->tx_prov_disc_info.peerIFAddr, GetAddr2Ptr(pframe), ETH_ALEN)) {
|
||||
if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_CLIENT)) {
|
||||
pwdinfo->tx_prov_disc_info.benable = false;
|
||||
issue_p2p_provision_request(padapter,
|
||||
|
@ -633,7 +633,7 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_GONEGO_ING)) {
|
||||
if (pwdinfo->nego_req_info.benable) {
|
||||
DBG_88E("[%s] P2P State is GONEGO ING!\n", __func__);
|
||||
if (_rtw_memcmp(pwdinfo->nego_req_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN)) {
|
||||
if (!memcmp(pwdinfo->nego_req_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN)) {
|
||||
pwdinfo->nego_req_info.benable = false;
|
||||
issue_p2p_GO_request(padapter, pwdinfo->nego_req_info.peerDevAddr);
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ unsigned int OnProbeRsp(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
} else if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_INVITE_REQ)) {
|
||||
if (pwdinfo->invitereq_info.benable) {
|
||||
DBG_88E("[%s] P2P_STATE_TX_INVITE_REQ!\n", __func__);
|
||||
if (_rtw_memcmp(pwdinfo->invitereq_info.peer_macaddr, GetAddr2Ptr(pframe), ETH_ALEN)) {
|
||||
if (!memcmp(pwdinfo->invitereq_info.peer_macaddr, GetAddr2Ptr(pframe), ETH_ALEN)) {
|
||||
pwdinfo->invitereq_info.benable = false;
|
||||
issue_p2p_invitation_request(padapter, pwdinfo->invitereq_info.peer_macaddr);
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
return _SUCCESS;
|
||||
}
|
||||
|
||||
if (_rtw_memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) {
|
||||
if (!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)) {
|
||||
if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) {
|
||||
/* we should update current network before auth, or some IE is wrong */
|
||||
pbss = (struct wlan_bssid_ex *)rtw_malloc(sizeof(struct wlan_bssid_ex));
|
||||
|
@ -872,7 +872,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
goto auth_fail;
|
||||
}
|
||||
|
||||
if (_rtw_memcmp((void *)(p + 2), pstat->chg_txt, 128)) {
|
||||
if (!memcmp((void *)(p + 2), pstat->chg_txt, 128)) {
|
||||
pstat->state &= (~WIFI_FW_AUTH_STATE);
|
||||
pstat->state |= WIFI_FW_AUTH_SUCCESS;
|
||||
/* challenging txt is correct... */
|
||||
|
@ -933,7 +933,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
|
|||
DBG_88E("%s\n", __func__);
|
||||
|
||||
/* check A1 matches or not */
|
||||
if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN))
|
||||
if (memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN))
|
||||
return _SUCCESS;
|
||||
|
||||
if (!(pmlmeinfo->state & WIFI_FW_AUTH_STATE))
|
||||
|
@ -1088,7 +1088,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
status = _STATS_FAILURE_;
|
||||
} else {
|
||||
/* check if ssid match */
|
||||
if (!_rtw_memcmp((void *)(p+2), cur->Ssid.Ssid, cur->Ssid.SsidLength))
|
||||
if (memcmp((void *)(p+2), cur->Ssid.Ssid, cur->Ssid.SsidLength))
|
||||
status = _STATS_FAILURE_;
|
||||
|
||||
if (ie_len != cur->Ssid.SsidLength)
|
||||
|
@ -1260,7 +1260,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
for (;;) {
|
||||
p = rtw_get_ie(p, _VENDOR_SPECIFIC_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset);
|
||||
if (p != NULL) {
|
||||
if (_rtw_memcmp(p+2, WMM_IE, 6)) {
|
||||
if (!memcmp(p+2, WMM_IE, 6)) {
|
||||
pstat->flags |= WLAN_STA_WME;
|
||||
|
||||
pstat->qos_option = 1;
|
||||
|
@ -1472,7 +1472,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
DBG_88E("%s\n", __func__);
|
||||
|
||||
/* check A1 matches or not */
|
||||
if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN))
|
||||
if (memcmp(myid(&(padapter->eeprompriv)), get_da(pframe), ETH_ALEN))
|
||||
return _SUCCESS;
|
||||
|
||||
if (!(pmlmeinfo->state & (WIFI_FW_AUTH_SUCCESS | WIFI_FW_ASSOC_STATE)))
|
||||
|
@ -1510,7 +1510,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:
|
||||
if (_rtw_memcmp(pIE->data, WMM_PARA_OUI, 6)) /* WMM */
|
||||
if (!memcmp(pIE->data, WMM_PARA_OUI, 6)) /* WMM */
|
||||
WMM_param_handler(padapter, pIE);
|
||||
break;
|
||||
case _HT_CAPABILITY_IE_: /* HT caps */
|
||||
|
@ -1558,7 +1558,7 @@ unsigned int OnDeAuth(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
/* check A3 */
|
||||
if (!(_rtw_memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
|
||||
if (!(!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
|
||||
return _SUCCESS;
|
||||
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
|
@ -1638,7 +1638,7 @@ unsigned int OnDisassoc(struct adapter *padapter, union recv_frame *precv_frame)
|
|||
#endif /* CONFIG_88EU_P2P */
|
||||
|
||||
/* check A3 */
|
||||
if (!(_rtw_memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
|
||||
if (!(!memcmp(GetAddr3Ptr(pframe), get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
|
||||
return _SUCCESS;
|
||||
|
||||
#ifdef CONFIG_88EU_P2P
|
||||
|
@ -1755,7 +1755,7 @@ unsigned int OnAction_back(struct adapter *padapter, union recv_frame *precv_fra
|
|||
u8 *pframe = precv_frame->u.hdr.rx_data;
|
||||
struct sta_priv *pstapriv = &padapter->stapriv;
|
||||
/* check RA matches or not */
|
||||
if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */
|
||||
if (memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */
|
||||
return _SUCCESS;
|
||||
|
||||
DBG_88E("%s\n", __func__);
|
||||
|
@ -2274,7 +2274,7 @@ static void issue_p2p_GO_response(struct adapter *padapter, u8 *raddr, u8 *frame
|
|||
/* Commented by Kurt 20120113 */
|
||||
/* If some device wants to do p2p handshake without sending prov_disc_req */
|
||||
/* We have to get peer_req_cm from here. */
|
||||
if (_rtw_memcmp(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3)) {
|
||||
if (!memcmp(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "000", 3)) {
|
||||
if (wps_devicepassword_id == WPS_DPID_USER_SPEC)
|
||||
memcpy(pwdinfo->rx_prov_disc_info.strconfig_method_desc_of_prov_disc_req, "dis", 3);
|
||||
else if (wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC)
|
||||
|
@ -2811,7 +2811,7 @@ void issue_p2p_invitation_request(struct adapter *padapter, u8 *raddr)
|
|||
/* Channel Number */
|
||||
p2pie[p2pielen++] = pwdinfo->invitereq_info.operating_ch; /* operating channel number */
|
||||
|
||||
if (_rtw_memcmp(myid(&padapter->eeprompriv), pwdinfo->invitereq_info.go_bssid, ETH_ALEN)) {
|
||||
if (!memcmp(myid(&padapter->eeprompriv), pwdinfo->invitereq_info.go_bssid, ETH_ALEN)) {
|
||||
/* P2P Group BSSID */
|
||||
/* Type: */
|
||||
p2pie[p2pielen++] = P2P_ATTR_GROUP_BSSID;
|
||||
|
@ -3242,7 +3242,7 @@ static u8 is_matched_in_profilelist(u8 *peermacaddr, struct profile_info *profil
|
|||
for (i = 0; i < P2P_MAX_PERSISTENT_GROUP_NUM; i++, profileinfo++) {
|
||||
DBG_88E("[%s] profileinfo_mac=%.2X %.2X %.2X %.2X %.2X %.2X\n", __func__,
|
||||
profileinfo->peermac[0], profileinfo->peermac[1], profileinfo->peermac[2], profileinfo->peermac[3], profileinfo->peermac[4], profileinfo->peermac[5]);
|
||||
if (_rtw_memcmp(peermacaddr, profileinfo->peermac, ETH_ALEN)) {
|
||||
if (!memcmp(peermacaddr, profileinfo->peermac, ETH_ALEN)) {
|
||||
match_result = 1;
|
||||
DBG_88E("[%s] Match!\n", __func__);
|
||||
break;
|
||||
|
@ -3915,7 +3915,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame)
|
|||
|
||||
/* Commented by Kurt 20120113 */
|
||||
/* Get peer_dev_addr here if peer doesn't issue prov_disc frame. */
|
||||
if (_rtw_memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN))
|
||||
if (!memcmp(pwdinfo->rx_prov_disc_info.peerDevAddr, empty_addr, ETH_ALEN))
|
||||
memcpy(pwdinfo->rx_prov_disc_info.peerDevAddr, GetAddr2Ptr(pframe), ETH_ALEN);
|
||||
|
||||
result = process_p2p_group_negotation_req(pwdinfo, frame_body, len);
|
||||
|
@ -3997,7 +3997,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame)
|
|||
memset(&group_id, 0x00, sizeof(struct group_id_info));
|
||||
rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, (u8 *)&group_id, &attr_contentlen);
|
||||
if (attr_contentlen) {
|
||||
if (_rtw_memcmp(group_id.go_device_addr, myid(&padapter->eeprompriv), ETH_ALEN)) {
|
||||
if (!memcmp(group_id.go_device_addr, myid(&padapter->eeprompriv), ETH_ALEN)) {
|
||||
/* The p2p device sending this p2p invitation request wants this Wi-Fi device to be the persistent GO. */
|
||||
rtw_p2p_set_state(pwdinfo, P2P_STATE_RECV_INVITE_REQ_GO);
|
||||
rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
|
||||
|
@ -4045,7 +4045,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame)
|
|||
memset(&group_id, 0x00, sizeof(struct group_id_info));
|
||||
rtw_get_p2p_attr_content(p2p_ie, p2p_ielen, P2P_ATTR_GROUP_ID, (u8 *)&group_id, &attr_contentlen);
|
||||
if (attr_contentlen) {
|
||||
if (_rtw_memcmp(group_id.go_device_addr, myid(&padapter->eeprompriv), ETH_ALEN)) {
|
||||
if (!memcmp(group_id.go_device_addr, myid(&padapter->eeprompriv), ETH_ALEN)) {
|
||||
/* In this case, the GO can't be myself. */
|
||||
rtw_p2p_set_state(pwdinfo, P2P_STATE_RECV_INVITE_REQ_DISMATCH);
|
||||
status_code = P2P_STATUS_FAIL_INFO_UNAVAILABLE;
|
||||
|
@ -4092,7 +4092,7 @@ static unsigned int on_action_public_p2p(union recv_frame *precv_frame)
|
|||
pwdinfo->invitereq_info.benable = false;
|
||||
|
||||
if (attr_content == P2P_STATUS_SUCCESS) {
|
||||
if (_rtw_memcmp(pwdinfo->invitereq_info.go_bssid, myid(&padapter->eeprompriv), ETH_ALEN)) {
|
||||
if (!memcmp(pwdinfo->invitereq_info.go_bssid, myid(&padapter->eeprompriv), ETH_ALEN)) {
|
||||
rtw_p2p_set_role(pwdinfo, P2P_ROLE_GO);
|
||||
} else {
|
||||
rtw_p2p_set_role(pwdinfo, P2P_ROLE_CLIENT);
|
||||
|
@ -4157,7 +4157,7 @@ static unsigned int on_action_public_vendor(union recv_frame *precv_frame)
|
|||
u8 *pframe = precv_frame->u.hdr.rx_data;
|
||||
u8 *frame_body = pframe + sizeof(struct rtw_ieee80211_hdr_3addr);
|
||||
|
||||
if (_rtw_memcmp(frame_body + 2, P2P_OUI, 4) == true) {
|
||||
if (!memcmp(frame_body + 2, P2P_OUI, 4)) {
|
||||
ret = on_action_public_p2p(precv_frame);
|
||||
}
|
||||
|
||||
|
@ -4190,7 +4190,7 @@ unsigned int on_action_public(struct adapter *padapter, union recv_frame *precv_
|
|||
u8 category, action;
|
||||
|
||||
/* check RA matches or not */
|
||||
if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))
|
||||
if (memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))
|
||||
goto exit;
|
||||
|
||||
category = frame_body[0];
|
||||
|
@ -4233,7 +4233,7 @@ unsigned int OnAction_p2p(struct adapter *padapter, union recv_frame *precv_fram
|
|||
DBG_88E("%s\n", __func__);
|
||||
|
||||
/* check RA matches or not */
|
||||
if (!_rtw_memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */
|
||||
if (memcmp(myid(&(padapter->eeprompriv)), GetAddr1Ptr(pframe), ETH_ALEN))/* for if1, sta/ap mode */
|
||||
return _SUCCESS;
|
||||
|
||||
frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr));
|
||||
|
@ -5200,7 +5200,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
|
|||
|
||||
for (pbuf = ie + _BEACON_IE_OFFSET_;; pbuf += (ie_len + 2)) {
|
||||
pbuf = rtw_get_ie(pbuf, _VENDOR_SPECIFIC_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_ - (ie_len + 2)));
|
||||
if (pbuf && _rtw_memcmp(pbuf+2, WMM_PARA_IE, 6)) {
|
||||
if (pbuf && !memcmp(pbuf+2, WMM_PARA_IE, 6)) {
|
||||
memcpy(pframe, pbuf, ie_len+2);
|
||||
pframe += (ie_len+2);
|
||||
pattrib->pktlen += (ie_len+2);
|
||||
|
@ -5404,14 +5404,14 @@ void issue_assocreq(struct adapter *padapter)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:
|
||||
if ((_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
|
||||
(_rtw_memcmp(pIE->data, WMM_OUI, 4)) ||
|
||||
(_rtw_memcmp(pIE->data, WPS_OUI, 4))) {
|
||||
if ((!memcmp(pIE->data, RTW_WPA_OUI, 4)) ||
|
||||
(!memcmp(pIE->data, WMM_OUI, 4)) ||
|
||||
(!memcmp(pIE->data, WPS_OUI, 4))) {
|
||||
if (!padapter->registrypriv.wifi_spec) {
|
||||
/* Commented by Kurt 20110629 */
|
||||
/* In some older APs, WPS handshake */
|
||||
/* would be fail if we append vender extensions informations to AP */
|
||||
if (_rtw_memcmp(pIE->data, WPS_OUI, 4))
|
||||
if (!memcmp(pIE->data, WPS_OUI, 4))
|
||||
pIE->Length = 14;
|
||||
}
|
||||
pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, pIE->Length, pIE->data, &(pattrib->pktlen));
|
||||
|
@ -6809,7 +6809,7 @@ unsigned int receive_disconnect(struct adapter *padapter, unsigned char *MacAddr
|
|||
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
|
||||
|
||||
/* check A3 */
|
||||
if (!(_rtw_memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
|
||||
if (!(!memcmp(MacAddr, get_my_bssid(&pmlmeinfo->network), ETH_ALEN)))
|
||||
return _SUCCESS;
|
||||
|
||||
DBG_88E("%s\n", __func__);
|
||||
|
@ -7849,7 +7849,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf)
|
|||
|
||||
switch (pIE->ElementID) {
|
||||
case _VENDOR_SPECIFIC_IE_:/* Get WMM IE. */
|
||||
if (_rtw_memcmp(pIE->data, WMM_OUI, 4))
|
||||
if (!memcmp(pIE->data, WMM_OUI, 4))
|
||||
pmlmeinfo->WMM_enable = 1;
|
||||
break;
|
||||
case _HT_CAPABILITY_IE_: /* Get HT Cap IE. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue