Verify center frequency seg0/seg1 mapping result before use
Handle the center frequency to channel mapping more cleanly by skipping the cases where the center frequencies are not set and verifying that the mapping succeeds when they are set. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
acea0654f0
commit
38719f113e
1 changed files with 8 additions and 4 deletions
|
@ -3907,10 +3907,14 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
|
|||
conf->ieee80211n = params->ht_enabled;
|
||||
conf->ieee80211ac = params->vht_enabled;
|
||||
conf->secondary_channel = params->sec_channel_offset;
|
||||
ieee80211_freq_to_chan(params->center_freq1,
|
||||
&seg0);
|
||||
ieee80211_freq_to_chan(params->center_freq2,
|
||||
&seg1);
|
||||
if (params->center_freq1 &&
|
||||
ieee80211_freq_to_chan(params->center_freq1, &seg0) ==
|
||||
NUM_HOSTAPD_MODES)
|
||||
return -1;
|
||||
if (params->center_freq2 &&
|
||||
ieee80211_freq_to_chan(params->center_freq2,
|
||||
&seg1) == NUM_HOSTAPD_MODES)
|
||||
return -1;
|
||||
hostapd_set_oper_centr_freq_seg0_idx(conf, seg0);
|
||||
hostapd_set_oper_centr_freq_seg1_idx(conf, seg1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue