From bc5369d4b30c5ea6444468c0d8bcaeaf9525cab6 Mon Sep 17 00:00:00 2001 From: Sergei Makarenkov Date: Sun, 18 Dec 2016 19:54:27 +0300 Subject: [PATCH] Do not place signal strength into radiotap header if this information is not available --- core/rtw_recv.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 635bc61..dad0a28 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -4007,7 +4007,7 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, rtap_hdr = (struct ieee80211_radiotap_header *)&hdr_buf[0]; rtap_hdr->it_version = PKTHDR_RADIOTAP_VERSION; - if(pHalData->NumTotalRFPath>0) { + if(pHalData->NumTotalRFPath>0 && pattrib->physt) { rtap_hdr->it_present |= (1<it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); - hdr_buf[rt_len] = pattrib->phy_info.RecvSignalPower; - rt_len += 1; + if(pattrib->physt) { + /* dBm Antenna Signal */ + rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); + hdr_buf[rt_len] = pattrib->phy_info.RecvSignalPower; + rt_len += 1; #if 0 /* dBm Antenna Noise */ @@ -4121,7 +4122,9 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, rt_len += 1; #endif - rt_len++; // alignment + rt_len++; // alignment + } + /* Signal Quality */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_LOCK_QUALITY); tmp_16bit = cpu_to_le16(pattrib->phy_info.SignalQuality); @@ -4240,13 +4243,14 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, rt_len += 2; } - for(i=0; iNumTotalRFPath; i++) { - hdr_buf[rt_len] = pattrib->phy_info.RxPwr[i]; - rt_len ++; - hdr_buf[rt_len] = i; - rt_len ++; + if (pattrib->physt) { + for(i=0; iNumTotalRFPath; i++) { + hdr_buf[rt_len] = pattrib->phy_info.RxPwr[i]; + rt_len ++; + hdr_buf[rt_len] = i; + rt_len ++; + } } - /* push to skb */ pskb = (_pkt *)buf; if (skb_headroom(pskb) < rt_len) {