From 60aa279428024ea78dcffe2c181ffee3cc1495f5 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Mon, 23 Aug 2021 14:01:00 +0200 Subject: [PATCH] Use is_multicast_ether_addr instead of custom macro IS_MCAST, the buffer is properly aligned. Link: https://lore.kernel.org/r/20210823120106.9633-3-straube.linux@gmail.com Link: https://lore.kernel.org/r/20210823120106.9633-4-straube.linux@gmail.com Link: https://lore.kernel.org/r/20210823120106.9633-5-straube.linux@gmail.com Link: https://lore.kernel.org/r/20210823120106.9633-6-straube.linux@gmail.com Link: https://lore.kernel.org/r/20210823120106.9633-7-straube.linux@gmail.com Link: https://lore.kernel.org/r/20210823120106.9633-8-straube.linux@gmail.com Link: https://lore.kernel.org/r/20210823120106.9633-9-straube.linux@gmail.com --- core/mesh/rtw_mesh.c | 10 ++++---- core/rtw_debug.c | 2 +- core/rtw_mlme.c | 3 +-- core/rtw_mp.c | 18 ++++++++------- core/rtw_mp_ioctl.c | 2 +- core/rtw_recv.c | 38 +++++++++++++++---------------- core/rtw_security.c | 8 +++---- core/rtw_sta_mgt.c | 2 +- core/rtw_tdls.c | 2 +- core/rtw_wapi.c | 8 +++---- core/rtw_wapi_sms4.c | 8 +++---- core/rtw_xmit.c | 24 +++++++++---------- hal/hal_com.c | 2 +- hal/led/hal_led.c | 4 ++-- hal/rtl8192e/usb/rtl8192eu_xmit.c | 8 +++---- include/wifi.h | 9 -------- os_dep/linux/ioctl_linux.c | 4 ++-- os_dep/linux/recv_linux.c | 2 +- 18 files changed, 73 insertions(+), 81 deletions(-) diff --git a/core/mesh/rtw_mesh.c b/core/mesh/rtw_mesh.c index 60b4bfe..1807993 100644 --- a/core/mesh/rtw_mesh.c +++ b/core/mesh/rtw_mesh.c @@ -3326,7 +3326,7 @@ int rtw_mesh_addr_resolve(_adapter *adapter, struct xmit_frame *xframe, _pkt *pk struct ethhdr etherhdr; struct pkt_attrib *attrib; struct rtw_mesh_path *mpath = NULL, *mppath = NULL; - u8 is_da_mcast; + bool is_da_mcast; u8 ae_need; #if CONFIG_RTW_MESH_DATA_BMC_TO_UC bool bmc_need = _TRUE; @@ -3346,7 +3346,7 @@ int rtw_mesh_addr_resolve(_adapter *adapter, struct xmit_frame *xframe, _pkt *pk _rtw_init_listhead(b2u_list); #endif - is_da_mcast = IS_MCAST(etherhdr.h_dest); + is_da_mcast = is_multicast_ether_addr(etherhdr.h_dest); if (!is_da_mcast) { struct sta_info *next_hop; bool mpp_lookup = 1; @@ -3560,7 +3560,7 @@ int rtw_mesh_rx_data_validate_hdr(_adapter *adapter, union recv_frame *rframe, s switch (rattrib->to_fr_ds) { case 1: - if (!IS_MCAST(GetAddr1Ptr(whdr))) + if (!is_multicast_ether_addr(GetAddr1Ptr(whdr))) goto exit; *sta = rtw_get_stainfo(stapriv, get_addr2_ptr(whdr)); if (*sta == NULL) { @@ -3577,7 +3577,7 @@ int rtw_mesh_rx_data_validate_hdr(_adapter *adapter, union recv_frame *rframe, s is_ra_bmc = 1; break; case 3: - if (IS_MCAST(GetAddr1Ptr(whdr))) + if (is_multicast_ether_addr(GetAddr1Ptr(whdr))) goto exit; *sta = rtw_get_stainfo(stapriv, get_addr2_ptr(whdr)); if (*sta == NULL) { @@ -3764,7 +3764,7 @@ int rtw_mesh_rx_msdu_act_check(union recv_frame *rframe struct rtw_mesh_info *minfo = &adapter->mesh_info; struct rx_pkt_attrib *rattrib = &rframe->u.hdr.attrib; struct rtw_mesh_path *mppath; - u8 is_mda_bmc = IS_MCAST(mda); + bool is_mda_bmc = is_multicast_ether_addr(mda); u8 is_mda_self = !is_mda_bmc && _rtw_memcmp(mda, adapter_mac_addr(adapter), ETH_ALEN); struct xmit_frame *xframe; struct pkt_attrib *xattrib; diff --git a/core/rtw_debug.c b/core/rtw_debug.c index ed89dfd..a6e07ed 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -5733,7 +5733,7 @@ ssize_t proc_set_tx_sa_query(struct file *file, const char __user *buffer, size_ for (index = 0; index < macid_ctl->num && index < NUM_STA; index++) { if (rtw_macid_is_used(macid_ctl, index) && !rtw_macid_is_bmc(macid_ctl, index)) { if (!_rtw_memcmp(get_my_bssid(&(pmlmeinfo->network)), &mac_addr[index][0], ETH_ALEN) - && !IS_MCAST(&mac_addr[index][0])) { + && !is_multicast_ether_addr(&mac_addr[index][0])) { issue_action_SA_Query(padapter, &mac_addr[index][0], 0, 0, (u8)key_type); RTW_INFO("STA[%u]:"MAC_FMT"\n", index , MAC_ARG(&mac_addr[index][0])); } diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 3ca7b67..34d46dd 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -5048,10 +5048,9 @@ void rtw_issue_addbareq_cmd(_adapter *padapter, struct xmit_frame *pxmitframe) struct sta_info *psta = NULL; struct ht_priv *phtpriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; - s32 bmcst = IS_MCAST(pattrib->ra); /* if(bmcst || (padapter->mlmepriv.LinkDetectInfo.bTxBusyTraffic == _FALSE)) */ - if (bmcst || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod < 100)) + if (is_multicast_ether_addr(pattrib->ra) || (padapter->mlmepriv.LinkDetectInfo.NumTxOkInPeriod < 100)) return; priority = pattrib->priority; diff --git a/core/rtw_mp.c b/core/rtw_mp.c index 0436aec..9b76f72 100644 --- a/core/rtw_mp.c +++ b/core/rtw_mp.c @@ -1474,12 +1474,13 @@ void fill_tx_desc_8188e(PADAPTER padapter) struct tx_desc *desc = (struct tx_desc *)&(pmp_priv->tx.desc); struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib); u32 pkt_size = pattrib->last_txcmdsz; - s32 bmcast = IS_MCAST(pattrib->ra); + bool bmcast; /* offset 0 */ #if !defined(CONFIG_RTL8188E_SDIO) && !defined(CONFIG_PCI_HCI) desc->txdw0 |= cpu_to_le32(OWN | FSG | LSG); desc->txdw0 |= cpu_to_le32(pkt_size & 0x0000FFFF); /* packet size */ desc->txdw0 |= cpu_to_le32(((TXDESC_SIZE + OFFSET_SZ) << OFFSET_SHT) & 0x00FF0000); /* 32 bytes for TX Desc */ + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) desc->txdw0 |= cpu_to_le32(BMC); /* broadcast packet */ @@ -1529,7 +1530,7 @@ void fill_tx_desc_8814a(PADAPTER padapter) struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib); u32 pkt_size = pattrib->last_txcmdsz; - s32 bmcast = IS_MCAST(pattrib->ra); + bool bmcast; u8 offset; /* SET_TX_DESC_FIRST_SEG_8814A(pDesc, 1); */ @@ -1546,7 +1547,7 @@ void fill_tx_desc_8814a(PADAPTER padapter) #else SET_TX_DESC_PKT_OFFSET_8814A(pDesc, 1); #endif - + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) SET_TX_DESC_BMC_8814A(pDesc, 1); @@ -1587,7 +1588,7 @@ void fill_tx_desc_8812a(PADAPTER padapter) struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib); u32 pkt_size = pattrib->last_txcmdsz; - s32 bmcast = IS_MCAST(pattrib->ra); + bool bmcast; u8 data_rate, pwr_status, offset; SET_TX_DESC_FIRST_SEG_8812(pDesc, 1); @@ -1605,6 +1606,7 @@ void fill_tx_desc_8812a(PADAPTER padapter) #else SET_TX_DESC_PKT_OFFSET_8812(pDesc, 1); #endif + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) SET_TX_DESC_BMC_8812(pDesc, 1); @@ -1641,7 +1643,7 @@ void fill_tx_desc_8192e(PADAPTER padapter) struct pkt_attrib *pattrib = &(pmp_priv->tx.attrib); u32 pkt_size = pattrib->last_txcmdsz; - s32 bmcast = IS_MCAST(pattrib->ra); + bool bmcast; u8 data_rate, pwr_status, offset; @@ -1656,7 +1658,7 @@ void fill_tx_desc_8192e(PADAPTER padapter) #else /* 8192EU 8192ES */ SET_TX_DESC_PKT_OFFSET_92E(pDesc, 1); #endif - + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) SET_TX_DESC_BMC_92E(pDesc, 1); @@ -1932,7 +1934,7 @@ void SetPacketTx(PADAPTER padapter) u32 pkt_size, i; struct rtw_ieee80211_hdr *hdr; u8 payload; - s32 bmcast; + bool bmcast; struct pkt_attrib *pattrib; struct mp_priv *pmp_priv; @@ -1949,7 +1951,7 @@ void SetPacketTx(PADAPTER padapter) memcpy(pattrib->src, adapter_mac_addr(padapter), ETH_ALEN); memcpy(pattrib->ta, pattrib->src, ETH_ALEN); memcpy(pattrib->ra, pattrib->dst, ETH_ALEN); - bmcast = IS_MCAST(pattrib->ra); + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) pattrib->psta = rtw_get_bcmc_stainfo(padapter); else diff --git a/core/rtw_mp_ioctl.c b/core/rtw_mp_ioctl.c index 2af9872..4dbc4ed 100644 --- a/core/rtw_mp_ioctl.c +++ b/core/rtw_mp_ioctl.c @@ -2418,7 +2418,7 @@ unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv) pattrib->nr_frags = 1; pattrib->priority = 0; #ifndef CONFIG_MP_LINUX - if (IS_MCAST(pethhdr->h_dest)) + if (is_multicast_ether_addr(pethhdr->h_dest)) pattrib->mac_id = 4; else pattrib->mac_id = 5; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 6c291dd..8c75586 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -485,7 +485,7 @@ sint recvframe_chkmic(_adapter *adapter, union recv_frame *precvframe) /* calculate mic code */ if (stainfo != NULL) { - if (IS_MCAST(prxattrib->ra)) { + if (is_multicast_ether_addr(prxattrib->ra)) { /* mickey=&psecuritypriv->dot118021XGrprxmickey.skey[0]; */ /* iv = precvframe->u.hdr.rx_data+prxattrib->hdrlen; */ /* rxdata_key_idx =( ((iv[3])>>6)&0x3) ; */ @@ -529,11 +529,11 @@ sint recvframe_chkmic(_adapter *adapter, union recv_frame *precvframe) /* double check key_index for some timing issue , */ /* cannot compare with psecuritypriv->dot118021XGrpKeyid also cause timing issue */ - if ((IS_MCAST(prxattrib->ra) == _TRUE) && (prxattrib->key_index != pmlmeinfo->key_index)) + if ((is_multicast_ether_addr(prxattrib->ra) == _TRUE) && (prxattrib->key_index != pmlmeinfo->key_index)) brpt_micerror = _FALSE; if ((prxattrib->bdecrypted == _TRUE) && (brpt_micerror == _TRUE)) { - rtw_handle_tkip_mic_err(adapter, stainfo, (u8)IS_MCAST(prxattrib->ra)); + rtw_handle_tkip_mic_err(adapter, stainfo, (u8)is_multicast_ether_addr(prxattrib->ra)); RTW_INFO(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted); } else { RTW_INFO(" mic error :prxattrib->bdecrypted=%d\n", prxattrib->bdecrypted); @@ -543,7 +543,7 @@ sint recvframe_chkmic(_adapter *adapter, union recv_frame *precvframe) } else { /* mic checked ok */ - if ((psecuritypriv->bcheck_grpkey == _FALSE) && (IS_MCAST(prxattrib->ra) == _TRUE)) { + if ((psecuritypriv->bcheck_grpkey == _FALSE) && (is_multicast_ether_addr(prxattrib->ra) == _TRUE)) { psecuritypriv->bcheck_grpkey = _TRUE; } } @@ -601,7 +601,7 @@ union recv_frame *decryptor(_adapter *padapter, union recv_frame *precv_frame) if (prxattrib->encrypt && !prxattrib->bdecrypted) { if (GetFrameType(get_recvframe_data(precv_frame)) == WIFI_DATA #ifdef CONFIG_CONCURRENT_MODE - && !IS_MCAST(prxattrib->ra) /* bc/mc packets may use sw decryption for concurrent mode */ + && !is_multicast_ether_addr(prxattrib->ra) /* bc/mc packets may use sw decryption for concurrent mode */ #endif ) psecuritypriv->hw_decrypted = _FALSE; @@ -859,12 +859,12 @@ sint recv_decache(union recv_frame *precv_frame) return _FAIL; if (pattrib->qos) { - if (IS_MCAST(pattrib->ra)) + if (is_multicast_ether_addr(pattrib->ra)) prxseq = &psta->sta_recvpriv.bmc_tid_rxseq[tid]; else prxseq = &psta->sta_recvpriv.rxcache.tid_rxseq[tid]; } else { - if (IS_MCAST(pattrib->ra)) { + if (is_multicast_ether_addr(pattrib->ra)) { prxseq = &psta->sta_recvpriv.nonqos_bmc_rxseq; #ifdef DBG_RX_SEQ RTW_INFO("DBG_RX_SEQ "FUNC_ADPT_FMT" nonqos bmc seq_num:%d\n" @@ -1113,7 +1113,7 @@ void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct sta_in padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++; - if (!is_broadcast_ether_addr(pattrib->dst) && !IS_MCAST(pattrib->dst)) + if (!is_broadcast_ether_addr(pattrib->dst) && !is_multicast_ether_addr(pattrib->dst)) padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++; if (sta) @@ -1122,7 +1122,7 @@ void count_rx_stats(_adapter *padapter, union recv_frame *prframe, struct sta_in psta = prframe->u.hdr.psta; if (psta) { - u8 is_ra_bmc = IS_MCAST(pattrib->ra); + u8 is_ra_bmc = is_multicast_ether_addr(pattrib->ra); pstats = &psta->sta_stats; @@ -1175,7 +1175,7 @@ sint sta2sta_data_frame( u8 *mybssid = get_bssid(pmlmepriv); u8 *myhwaddr = adapter_mac_addr(adapter); u8 *sta_addr = pattrib->ta; - sint bmcast = IS_MCAST(pattrib->dst); + sint bmcast = is_multicast_ether_addr(pattrib->dst); #ifdef CONFIG_TDLS struct tdls_info *ptdlsinfo = &adapter->tdlsinfo; @@ -1296,7 +1296,7 @@ sint sta2sta_data_frame( } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == _TRUE) { if (bmcast) { /* For AP mode, if DA == MCAST, then BSSID should be also MCAST */ - if (!IS_MCAST(pattrib->bssid)) { + if (!is_multicast_ether_addr(pattrib->bssid)) { ret = _FAIL; goto exit; } @@ -1352,7 +1352,7 @@ sint ap2sta_data_frame( struct mlme_priv *pmlmepriv = &adapter->mlmepriv; u8 *mybssid = get_bssid(pmlmepriv); u8 *myhwaddr = adapter_mac_addr(adapter); - sint bmcast = IS_MCAST(pattrib->dst); + sint bmcast = is_multicast_ether_addr(pattrib->dst); if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE) @@ -1758,7 +1758,7 @@ static sint validate_mgmt_protect(_adapter *adapter, union recv_frame *precv_fra ptr = precv_frame->u.hdr.rx_data; type = GetFrameType(ptr); subtype = get_frame_sub_type(ptr); /* bit(7)~bit(2) */ - is_bmc = IS_MCAST(GetAddr1Ptr(ptr)); + is_bmc = is_multicast_ether_addr(GetAddr1Ptr(ptr)); #if DBG_VALIDATE_MGMT_PROTECT if (subtype == WIFI_DEAUTH) { @@ -2153,7 +2153,7 @@ pre_validate_status_chk: if (ret == _FAIL) goto exit; - if (!IS_MCAST(pattrib->ra)) { + if (!is_multicast_ether_addr(pattrib->ra)) { if (pattrib->qos) precv_frame->u.hdr.preorder_ctrl = &psta->recvreorder_ctrl[pattrib->priority]; @@ -2183,7 +2183,7 @@ pre_validate_status_chk: pattrib->encrypt = psta->dot118021XPrivacy; else #endif /* CONFIG_TDLS */ - GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, IS_MCAST(pattrib->ra)); + GET_ENCRY_ALGO(psecuritypriv, psta, pattrib->encrypt, is_multicast_ether_addr(pattrib->ra)); SET_ICE_IV_LEN(pattrib->iv_len, pattrib->icv_len, pattrib->encrypt); @@ -4341,7 +4341,7 @@ int recv_func_posthandle(_adapter *padapter, union recv_frame *prframe) } #ifdef DBG_RX_BMC_FRAME - if (IS_MCAST(pattrib->ra)) + if (is_multicast_ether_addr(pattrib->ra)) RTW_INFO("%s =>"ADPT_FMT" Rx BC/MC from "MAC_FMT"\n", __func__, ADPT_ARG(padapter), MAC_ARG(pattrib->ta)); #endif @@ -4478,7 +4478,7 @@ int recv_func(_adapter *padapter, union recv_frame *rframe) /* check if need to enqueue into uc_swdec_pending_queue*/ if (check_fwstate(mlmepriv, WIFI_STATION_STATE) && - !IS_MCAST(prxattrib->ra) && prxattrib->encrypt > 0 && + !is_multicast_ether_addr(prxattrib->ra) && prxattrib->encrypt > 0 && (prxattrib->bdecrypted == 0 || psecuritypriv->sw_decrypt == _TRUE) && psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPAPSK && !psecuritypriv->busetkipkey) { @@ -4787,7 +4787,7 @@ void rx_query_phy_status( ta = get_ta(wlanhdr); ra = get_ra(wlanhdr); - is_ra_bmc = IS_MCAST(ra); + is_ra_bmc = is_multicast_ether_addr(ra); if (_rtw_memcmp(adapter_mac_addr(padapter), ta, ETH_ALEN) == _TRUE) { static systime start_time = 0; @@ -4927,7 +4927,7 @@ s32 pre_recv_entry(union recv_frame *precvframe, u8 *pphy_status) s32 ret = _SUCCESS; u8 *pbuf = precvframe->u.hdr.rx_data; u8 *pda = get_ra(pbuf); - u8 ra_is_bmc = IS_MCAST(pda); + u8 ra_is_bmc = is_multicast_ether_addr(pda); _adapter *primary_padapter = precvframe->u.hdr.adapter; #ifdef CONFIG_CONCURRENT_MODE _adapter *iface = NULL; diff --git a/core/rtw_security.c b/core/rtw_security.c index 4787bab..8d8b4cd 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -732,7 +732,7 @@ u32 rtw_tkip_encrypt(_adapter *padapter, u8 *pxmitframe) } */ - if (IS_MCAST(pattrib->ra)) + if (is_multicast_ether_addr(pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; else { /* prwskey=&stainfo->dot118021x_UncstKey.skey[0]; */ @@ -820,7 +820,7 @@ u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe) stainfo = rtw_get_stainfo(&padapter->stapriv , &prxattrib->ta[0]); if (stainfo != NULL) { - if (IS_MCAST(prxattrib->ra)) { + if (is_multicast_ether_addr(prxattrib->ra)) { static systime start = 0; static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_mc_cnt = 0; @@ -1597,7 +1597,7 @@ u32 rtw_aes_encrypt(_adapter *padapter, u8 *pxmitframe) } */ - if (IS_MCAST(pattrib->ra)) + if (is_multicast_ether_addr(pattrib->ra)) prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; else { /* prwskey=&stainfo->dot118021x_UncstKey.skey[0]; */ @@ -1935,7 +1935,7 @@ u32 rtw_aes_decrypt(_adapter *padapter, u8 *precvframe) stainfo = rtw_get_stainfo(&padapter->stapriv , &prxattrib->ta[0]); if (stainfo != NULL) { - if (IS_MCAST(prxattrib->ra)) { + if (is_multicast_ether_addr(prxattrib->ra)) { static systime start = 0; static u32 no_gkey_bc_cnt = 0; static u32 no_gkey_mc_cnt = 0; diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 0777693..6cb3731 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -859,7 +859,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, const u8 *hwaddr) if (hwaddr == NULL) return NULL; - if (IS_MCAST(hwaddr)) + if (is_multicast_ether_addr(hwaddr)) addr = bc_addr; else addr = hwaddr; diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c index e2dca93..67926b5 100644 --- a/core/rtw_tdls.c +++ b/core/rtw_tdls.c @@ -1221,7 +1221,7 @@ int issue_tdls_setup_req(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, int wa if (rtw_tdls_is_setup_allowed(padapter) == _FALSE) goto exit; - if (IS_MCAST(ptxmgmt->peer)) + if (is_multicast_ether_addr(ptxmgmt->peer)) goto exit; ptdls_sta = rtw_get_stainfo(pstapriv, ptxmgmt->peer); diff --git a/core/rtw_wapi.c b/core/rtw_wapi.c index 6787e62..2502f8a 100644 --- a/core/rtw_wapi.c +++ b/core/rtw_wapi.c @@ -512,7 +512,7 @@ u8 rtw_wapi_check_for_drop( WAPI_TRACE(WAPI_RX, "%s: bFind=%d prxb->WapiSrcAddr="MAC_FMT"\n", __FUNCTION__, bFind, MAC_ARG(precv_hdr->WapiSrcAddr)); if (bFind) { - if (IS_MCAST(precv_hdr->attrib.ra)) { + if (is_multicast_ether_addr(precv_hdr->attrib.ra)) { WAPI_TRACE(WAPI_RX, "rtw_wapi_check_for_drop: multicast case\n"); pLastRecvPN = pWapiSta->lastRxMulticastPN; } else { @@ -542,7 +542,7 @@ u8 rtw_wapi_check_for_drop( if (!WapiComparePN(precv_hdr->WapiTempPN, pLastRecvPN)) { WAPI_TRACE(WAPI_RX, "%s: Equal PN!!\n", __FUNCTION__); - if (IS_MCAST(precv_hdr->attrib.ra)) + if (is_multicast_ether_addr(precv_hdr->attrib.ra)) memcpy(pLastRecvPN, WapiAEMultiCastPNInitialValueSrc, 16); else memcpy(pLastRecvPN, WapiAEPNInitialValueSrc, 16); @@ -1148,7 +1148,7 @@ void rtw_wapi_get_iv(_adapter *padapter, u8 *pRA, u8 *IV) WAPI_DATA(WAPI_RX, "wapi_get_iv: pra", pRA, 6); - if (IS_MCAST(pRA)) { + if (is_multicast_ether_addr(pRA)) { if (!pWapiInfo->wapiTxMsk.bTxEnable) { WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__); return; @@ -1213,7 +1213,7 @@ bool rtw_wapi_drop_for_key_absent(_adapter *padapter, u8 *pRA) if ((!padapter->WapiSupport) || (!pWapiInfo->bWapiEnable)) return true; - if (IS_MCAST(pRA)) { + if (is_multicast_ether_addr(pRA)) { if (!pWapiInfo->wapiTxMsk.bTxEnable) { bDrop = true; WAPI_TRACE(WAPI_RX, "rtw_wapi_drop_for_key_absent: multicast key is absent\n"); diff --git a/core/rtw_wapi_sms4.c b/core/rtw_wapi_sms4.c index 4b7cf95..d96865a 100644 --- a/core/rtw_wapi_sms4.c +++ b/core/rtw_wapi_sms4.c @@ -523,7 +523,7 @@ int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe) WAPI_DATA(WAPI_TX, "FillIV - Before Fill IV", pskb->data, pskb->len); /* Address 1 is always receiver's address */ - if (IS_MCAST(pRA)) { + if (is_multicast_ether_addr(pRA)) { if (!pWapiInfo->wapiTxMsk.bTxEnable) { WAPI_TRACE(WAPI_ERR, "%s: bTxEnable = 0!!\n", __FUNCTION__); return -2; @@ -610,7 +610,7 @@ void SecSWSMS4Encryption( pRA = pframe + 4; - if (IS_MCAST(pRA)) { + if (is_multicast_ether_addr(pRA)) { KeyIdx = pWapiInfo->wapiTxMsk.keyId; pIV = pWapiInfo->lastTxMulticastPN; pMicKey = pWapiInfo->wapiTxMsk.micKey; @@ -728,7 +728,7 @@ u8 SecSWSMS4Decryption( return false; } - if (IS_MCAST(pRA)) { + if (is_multicast_ether_addr(pRA)) { WAPI_TRACE(WAPI_RX, "%s: Multicast decryption !!!\n", __FUNCTION__); if (pWapiSta->wapiMsk.keyId == KeyIdx && pWapiSta->wapiMsk.bSet) { pLastRxPN = pWapiSta->lastRxMulticastPN; @@ -821,7 +821,7 @@ u8 SecSWSMS4Decryption( WAPI_TRACE(WAPI_RX, "%s: Check MIC OK!!\n", __FUNCTION__); if (bUseUpdatedKey) { /* delete the old key */ - if (IS_MCAST(pRA)) { + if (is_multicast_ether_addr(pRA)) { WAPI_TRACE(WAPI_API, "%s(): AE use new update MSK!!\n", __FUNCTION__); pWapiSta->wapiMsk.keyId = pWapiSta->wapiMskUpdate.keyId; memcpy(pWapiSta->wapiMsk.dataKey, pWapiSta->wapiMskUpdate.dataKey, 16); diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 88c6ac1..e53f5b8 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -967,7 +967,7 @@ static s32 update_attrib_sec_info(_adapter *padapter, struct pkt_attrib *pattrib sint res = _SUCCESS; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - sint bmcast = IS_MCAST(pattrib->ra); + bool bmcast = is_multicast_ether_addr(pattrib->ra); memset(pattrib->dot118021x_UncstKey.skey, 0, 16); memset(pattrib->dot11tkiptxmickey.skey, 0, 16); @@ -1309,7 +1309,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr struct sta_info *psta = NULL; struct ethhdr etherhdr; - sint bmcast; + bool bmcast; struct sta_priv *pstapriv = &padapter->stapriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct qos_priv *pqospriv = &pmlmepriv->qospriv; @@ -1354,7 +1354,7 @@ static s32 update_attrib(_adapter *padapter, _pkt *pkt, struct pkt_attrib *pattr DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_unknown); get_sta_info: - bmcast = IS_MCAST(pattrib->ra); + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) { psta = rtw_get_bcmc_stainfo(padapter); if (psta == NULL) { /* if we cannot get psta => drop the pkt */ @@ -1473,7 +1473,7 @@ get_sta_info: if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && pattrib->ether_type == ETH_P_ARP && - !IS_MCAST(pattrib->dst)) { + !is_multicast_ether_addr(pattrib->dst)) { rtw_mi_set_scan_deny(padapter, 1000); rtw_mi_scan_abort(padapter, _FALSE); /*rtw_scan_abort_no_wait*/ } @@ -1574,7 +1574,7 @@ static s32 xmitframe_addmic(_adapter *padapter, struct xmit_frame *pxmitframe) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; u8 priority[4] = {0x0, 0x0, 0x0, 0x0}; u8 hw_hdr_offset = 0; - sint bmcst = IS_MCAST(pattrib->ra); + bool bmcst = is_multicast_ether_addr(pattrib->ra); /* if(pattrib->psta) @@ -1742,7 +1742,7 @@ s32 rtw_make_wlanhdr(_adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib) /* struct sta_info *psta; */ - /* sint bmcst = IS_MCAST(pattrib->ra); */ + /* sint bmcst = is_multicast_ether_addr(pattrib->ra); */ /* @@ -2184,7 +2184,7 @@ s32 rtw_xmit_tdls_coalesce(_adapter *padapter, struct xmit_frame *pxmitframe, st struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; u8 *pbuf_start; - s32 bmcst = IS_MCAST(pattrib->ra); + bool bmcst = is_multicast_ether_addr(pattrib->ra); s32 res = _SUCCESS; @@ -2311,7 +2311,7 @@ s32 check_amsdu(struct xmit_frame *pxmitframe) pattrib = &pxmitframe->attrib; - if (IS_MCAST(pattrib->ra)) + if (is_multicast_ether_addr(pattrib->ra)) ret = _FALSE; if ((pattrib->ether_type == 0x888e) || @@ -2578,7 +2578,7 @@ s32 rtw_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame *pxm u8 *pbuf_start; - s32 bmcst = IS_MCAST(pattrib->ra); + bool bmcst = is_multicast_ether_addr(pattrib->ra); s32 res = _SUCCESS; @@ -2783,7 +2783,7 @@ s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; u8 *pbuf_start; - s32 bmcst = IS_MCAST(pattrib->ra); + bool bmcst = is_multicast_ether_addr(pattrib->ra); s32 res = _FAIL; u8 *BIP_AAD = NULL; u8 *MGMT_body = NULL; @@ -3926,7 +3926,7 @@ __inline static struct tx_servq *rtw_get_sta_pending #ifdef CONFIG_RTL8711 - if (IS_MCAST(psta->cmn.mac_addr)) { + if (is_multicast_ether_addr(psta->cmn.mac_addr)) { ptxservq = &(psta->sta_xmitpriv.be_q); /* we will use be_q to queue bc/mc frames in BCMC_stainfo */ *ppstapending = &padapter->xmitpriv.bm_pending; } else @@ -4751,7 +4751,7 @@ sint xmitframe_enqueue_for_sleeping_sta(_adapter *padapter, struct xmit_frame *p struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; struct pkt_attrib *pattrib = &pxmitframe->attrib; - sint bmcst = IS_MCAST(pattrib->ra); + bool bmcst = is_multicast_ether_addr(pattrib->ra); bool update_tim = _FALSE; #ifdef CONFIG_TDLS diff --git a/hal/hal_com.c b/hal/hal_com.c index e4fd59b..825bfba 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -12527,7 +12527,7 @@ void rtw_store_phy_info(_adapter *padapter, union recv_frame *prframe) /*RTW_INFO("=>%s WIFI_DATA_TYPE or WIFI_QOS_DATA_TYPE\n", __FUNCTION__);*/ if (psta) { - if (IS_MCAST(get_ra(get_recvframe_data(prframe)))) + if (is_multicast_ether_addr(get_ra(get_recvframe_data(prframe)))) psta_dframe_info = &psta->sta_dframe_info_bmc; else psta_dframe_info = &psta->sta_dframe_info; diff --git a/hal/led/hal_led.c b/hal/led/hal_led.c index 95d3daa..de21049 100644 --- a/hal/led/hal_led.c +++ b/hal/led/hal_led.c @@ -184,7 +184,7 @@ void rtw_led_control(_adapter *adapter, LED_CTL_MODE ctl) void rtw_led_tx_control(_adapter *adapter, const u8 *da) { #if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY - if (IS_MCAST(da)) + if (is_multicast_ether_addr(da)) rtw_led_control(adapter, LED_CTL_BMC_TX); else rtw_led_control(adapter, LED_CTL_UC_TX); @@ -196,7 +196,7 @@ void rtw_led_tx_control(_adapter *adapter, const u8 *da) void rtw_led_rx_control(_adapter *adapter, const u8 *da) { #if CONFIG_RTW_SW_LED_TRX_DA_CLASSIFY - if (IS_MCAST(da)) + if (is_multicast_ether_addr(da)) rtw_led_control(adapter, LED_CTL_BMC_RX); else rtw_led_control(adapter, LED_CTL_UC_RX); diff --git a/hal/rtl8192e/usb/rtl8192eu_xmit.c b/hal/rtl8192e/usb/rtl8192eu_xmit.c index 2f0b21e..ceede6d 100644 --- a/hal/rtl8192e/usb/rtl8192eu_xmit.c +++ b/hal/rtl8192e/usb/rtl8192eu_xmit.c @@ -58,7 +58,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba u8 *ptxdesc = pmem; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - sint bmcst = IS_MCAST(pattrib->ra); + bool bmcst = is_multicast_ether_addr(pattrib->ra); #ifndef CONFIG_USE_USB_BUFFER_ALLOC_TX if (padapter->registrypriv.mp_mode == 0) { @@ -918,7 +918,7 @@ s32 rtl8192eu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt) /* #ifdef PLATFORM_LINUX */ u16 fc; int rc, len, pipe; - unsigned int bmcst, tid, qsel; + bool bmcst, tid, qsel; struct sk_buff *skb, *pxmit_skb; struct urb *urb; unsigned char *pxmitbuf; @@ -937,7 +937,7 @@ s32 rtl8192eu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt) len = skb->len; tx_hdr = (struct rtw_ieee80211_hdr *)(skb->data); fc = le16_to_cpu(tx_hdr->frame_ctl); - bmcst = IS_MCAST(tx_hdr->addr1); + bmcst = is_multicast_ether_addr(tx_hdr->addr1); if ((fc & RTW_IEEE80211_FCTL_FTYPE) != RTW_IEEE80211_FTYPE_MGMT) goto _exit; @@ -994,7 +994,7 @@ s32 rtl8192eu_hostap_mgnt_xmit_entry(_adapter *padapter, _pkt *pkt) /* */ skb_put(pxmit_skb, len + TXDESC_SIZE); pxmitbuf = pxmitbuf + TXDESC_SIZE; - memcpy(pxmitbuf, skb->data, len); + _rtw_memcpy(pxmitbuf, skb->data, len); /* RTW_INFO("mgnt_xmit, len=%x\n", pxmit_skb->len); */ diff --git a/include/wifi.h b/include/wifi.h index ae5273a..f45a0df 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -364,15 +364,6 @@ enum WIFI_REG_DOMAIN { #define GetAddr4Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 24)) - -__inline static int IS_MCAST(const u8 *da) -{ - if ((*da) & 0x01) - return _TRUE; - else - return _FALSE; -} - __inline static unsigned char *get_ra(unsigned char *pframe) { unsigned char *ra; diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index 0be7658..04b23a9 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -11447,7 +11447,7 @@ static struct xmit_frame *createloopbackpkt(PADAPTER padapter, u32 size) struct tx_desc *desc; u8 *pkt_start, *pkt_end, *ptr; struct rtw_ieee80211_hdr *hdr; - s32 bmcast; + bool bmcast; _irqL irqL; @@ -11502,7 +11502,7 @@ static struct xmit_frame *createloopbackpkt(PADAPTER padapter, u32 size) pattrib->bswenc = _FALSE; pattrib->qos_en = _FALSE; - bmcast = IS_MCAST(pattrib->ra); + bmcast = is_multicast_ether_addr(pattrib->ra); if (bmcast) pattrib->psta = rtw_get_bcmc_stainfo(padapter); else diff --git a/os_dep/linux/recv_linux.c b/os_dep/linux/recv_linux.c index 593f55f..ad3e27f 100644 --- a/os_dep/linux/recv_linux.c +++ b/os_dep/linux/recv_linux.c @@ -442,7 +442,7 @@ void rtw_os_recv_indicate_pkt(_adapter *padapter, _pkt *pkt, union recv_frame *r _pkt *pskb2 = NULL; struct sta_info *psta = NULL; struct sta_priv *pstapriv = &padapter->stapriv; - int bmcast = IS_MCAST(ehdr->h_dest); + bool bmcast = is_multicast_ether_addr(ehdr->h_dest); /* RTW_INFO("bmcast=%d\n", bmcast); */