From 658d3a51686071fbac7f9a5409ce1bf8ea6c508e Mon Sep 17 00:00:00 2001 From: kimocoder Date: Sat, 1 Feb 2020 07:17:49 +0100 Subject: [PATCH] Report correct band in RX radiotap --- core/rtw_recv.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 64edefd..83fa142 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -4103,16 +4103,25 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, tmp_16bit = 0; rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_CHANNEL); tmp_16bit = CHAN2FREQ(rtw_get_oper_ch(padapter)); - /*tmp_16bit = CHAN2FREQ(pHalData->current_channel);*/ memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); rt_len += 2; /* channel flags */ - tmp_16bit = 0; - if (pHalData->current_band_type == 0) + if (pHalData->current_band_type == BAND_ON_2_4G) { + tmp_16bit = 0; tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_2GHZ); - else + } else if (pHalData->current_band_type == BAND_ON_5G) { + tmp_16bit = 0; tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_5GHZ); + } else { + if (tmp_16bit >= 5000) { + tmp_16bit = 0; + tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_5GHZ); + } else { + tmp_16bit = 0; + tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_2GHZ); + } + } if (pattrib->data_rate <= DESC_RATE54M) { if (pattrib->data_rate <= DESC_RATE11M) { @@ -4122,8 +4131,9 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, /* OFDM */ tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_OFDM); } - } else + } else { tmp_16bit |= cpu_to_le16(IEEE80211_CHAN_DYN); + } memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); rt_len += 2;