mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-21 03:23:04 -05:00
Search through all hw_features sets in hw_get_channel_freq()
The 5 GHz channels are stored in one hw_features set with mode HOSTAPD_MODE_IEEE80211A while the 6 GHz channels will need to stored in a separate hw_features set (but with same mode HOSTAPD_MODE_IEEE80211A) due to possibility of different HE capabilities being available between the 5 GHz and 6 GHz bands. Search through all hw_features sets whose mode is same as the input mode while finding channel corresponding to the input frequency in hw_get_channel_freq(). Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
15d3568739
commit
840532aea5
@ -987,7 +987,9 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
|
|||||||
for (i = 0; i < iface->num_hw_features; i++) {
|
for (i = 0; i < iface->num_hw_features; i++) {
|
||||||
struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
||||||
if (mode->mode == iface->conf->hw_mode) {
|
if (mode->mode == iface->conf->hw_mode) {
|
||||||
if (freq > 0 && !hw_get_chan(mode, freq))
|
if (freq > 0 && !hw_get_chan(mode->mode, freq,
|
||||||
|
iface->hw_features,
|
||||||
|
iface->num_hw_features))
|
||||||
continue;
|
continue;
|
||||||
iface->current_mode = mode;
|
iface->current_mode = mode;
|
||||||
break;
|
break;
|
||||||
@ -1051,7 +1053,9 @@ int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
|
|||||||
struct hostapd_hw_modes *mode;
|
struct hostapd_hw_modes *mode;
|
||||||
|
|
||||||
if (hapd->iface->current_mode) {
|
if (hapd->iface->current_mode) {
|
||||||
channel = hw_get_chan(hapd->iface->current_mode, freq);
|
channel = hw_get_chan(hapd->iface->current_mode->mode, freq,
|
||||||
|
hapd->iface->hw_features,
|
||||||
|
hapd->iface->num_hw_features);
|
||||||
if (channel)
|
if (channel)
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
@ -1062,7 +1066,9 @@ int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
|
|||||||
return 0;
|
return 0;
|
||||||
for (i = 0; i < hapd->iface->num_hw_features; i++) {
|
for (i = 0; i < hapd->iface->num_hw_features; i++) {
|
||||||
mode = &hapd->iface->hw_features[i];
|
mode = &hapd->iface->hw_features[i];
|
||||||
channel = hw_get_chan(mode, freq);
|
channel = hw_get_chan(mode->mode, freq,
|
||||||
|
hapd->iface->hw_features,
|
||||||
|
hapd->iface->num_hw_features);
|
||||||
if (channel)
|
if (channel)
|
||||||
return channel;
|
return channel;
|
||||||
}
|
}
|
||||||
|
@ -40,23 +40,32 @@ struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct hostapd_channel_data * hw_get_channel_freq(struct hostapd_hw_modes *mode,
|
struct hostapd_channel_data *
|
||||||
int freq, int *chan)
|
hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
||||||
|
struct hostapd_hw_modes *hw_features, int num_hw_features)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
if (chan)
|
if (chan)
|
||||||
*chan = 0;
|
*chan = 0;
|
||||||
|
|
||||||
if (!mode)
|
if (!hw_features)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < mode->num_channels; i++) {
|
for (j = 0; j < num_hw_features; j++) {
|
||||||
struct hostapd_channel_data *ch = &mode->channels[i];
|
struct hostapd_hw_modes *curr_mode = &hw_features[j];
|
||||||
if (ch->freq == freq) {
|
|
||||||
if (chan)
|
if (curr_mode->mode != mode)
|
||||||
*chan = ch->chan;
|
continue;
|
||||||
return ch;
|
for (i = 0; i < curr_mode->num_channels; i++) {
|
||||||
|
struct hostapd_channel_data *ch =
|
||||||
|
&curr_mode->channels[i];
|
||||||
|
|
||||||
|
if (ch->freq == freq) {
|
||||||
|
if (chan)
|
||||||
|
*chan = ch->chan;
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,11 +83,12 @@ int hw_get_freq(struct hostapd_hw_modes *mode, int chan)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int hw_get_chan(struct hostapd_hw_modes *mode, int freq)
|
int hw_get_chan(enum hostapd_hw_mode mode, int freq,
|
||||||
|
struct hostapd_hw_modes *hw_features, int num_hw_features)
|
||||||
{
|
{
|
||||||
int chan;
|
int chan;
|
||||||
|
|
||||||
hw_get_channel_freq(mode, freq, &chan);
|
hw_get_channel_freq(mode, freq, &chan, hw_features, num_hw_features);
|
||||||
|
|
||||||
return chan;
|
return chan;
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,13 @@
|
|||||||
|
|
||||||
struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
||||||
int chan, int *freq);
|
int chan, int *freq);
|
||||||
struct hostapd_channel_data * hw_get_channel_freq(struct hostapd_hw_modes *mode,
|
struct hostapd_channel_data *
|
||||||
int freq, int *chan);
|
hw_get_channel_freq(enum hostapd_hw_mode mode, int freq, int *chan,
|
||||||
|
struct hostapd_hw_modes *hw_features, int num_hw_features);
|
||||||
|
|
||||||
int hw_get_freq(struct hostapd_hw_modes *mode, int chan);
|
int hw_get_freq(struct hostapd_hw_modes *mode, int chan);
|
||||||
int hw_get_chan(struct hostapd_hw_modes *mode, int freq);
|
int hw_get_chan(enum hostapd_hw_mode mode, int freq,
|
||||||
|
struct hostapd_hw_modes *hw_features, int num_hw_features);
|
||||||
|
|
||||||
int allowed_ht40_channel_pair(struct hostapd_hw_modes *mode, int pri_chan,
|
int allowed_ht40_channel_pair(struct hostapd_hw_modes *mode, int pri_chan,
|
||||||
int sec_chan);
|
int sec_chan);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user