mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-02-20 02:53:03 -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++) {
|
||||
struct hostapd_hw_modes *mode = &iface->hw_features[i];
|
||||
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;
|
||||
iface->current_mode = mode;
|
||||
break;
|
||||
@ -1051,7 +1053,9 @@ int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
|
||||
struct hostapd_hw_modes *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)
|
||||
return channel;
|
||||
}
|
||||
@ -1062,7 +1066,9 @@ int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq)
|
||||
return 0;
|
||||
for (i = 0; i < hapd->iface->num_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)
|
||||
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,
|
||||
int freq, int *chan)
|
||||
struct hostapd_channel_data *
|
||||
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)
|
||||
*chan = 0;
|
||||
|
||||
if (!mode)
|
||||
if (!hw_features)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < mode->num_channels; i++) {
|
||||
struct hostapd_channel_data *ch = &mode->channels[i];
|
||||
if (ch->freq == freq) {
|
||||
if (chan)
|
||||
*chan = ch->chan;
|
||||
return ch;
|
||||
for (j = 0; j < num_hw_features; j++) {
|
||||
struct hostapd_hw_modes *curr_mode = &hw_features[j];
|
||||
|
||||
if (curr_mode->mode != mode)
|
||||
continue;
|
||||
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;
|
||||
|
||||
hw_get_channel_freq(mode, freq, &chan);
|
||||
hw_get_channel_freq(mode, freq, &chan, hw_features, num_hw_features);
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
@ -14,11 +14,13 @@
|
||||
|
||||
struct hostapd_channel_data * hw_get_channel_chan(struct hostapd_hw_modes *mode,
|
||||
int chan, int *freq);
|
||||
struct hostapd_channel_data * hw_get_channel_freq(struct hostapd_hw_modes *mode,
|
||||
int freq, int *chan);
|
||||
struct hostapd_channel_data *
|
||||
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_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 sec_chan);
|
||||
|
Loading…
x
Reference in New Issue
Block a user