mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
treewide: update scan utility usage to use band_*
This commit is contained in:
parent
f3c9b66f08
commit
56ea2c4d15
9
src/ap.c
9
src/ap.c
@ -57,6 +57,7 @@
|
|||||||
#include "src/ap.h"
|
#include "src/ap.h"
|
||||||
#include "src/storage.h"
|
#include "src/storage.h"
|
||||||
#include "src/diagnostic.h"
|
#include "src/diagnostic.h"
|
||||||
|
#include "src/band.h"
|
||||||
|
|
||||||
struct ap_state {
|
struct ap_state {
|
||||||
struct netdev *netdev;
|
struct netdev *netdev;
|
||||||
@ -895,7 +896,7 @@ static uint32_t ap_send_mgmt_frame(struct ap_state *ap,
|
|||||||
frame_xchg_cb_t callback,
|
frame_xchg_cb_t callback,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
uint32_t ch_freq = scan_channel_to_freq(ap->channel, SCAN_BAND_2_4_GHZ);
|
uint32_t ch_freq = band_channel_to_freq(ap->channel, BAND_FREQ_2_4_GHZ);
|
||||||
uint64_t wdev_id = netdev_get_wdev_id(ap->netdev);
|
uint64_t wdev_id = netdev_get_wdev_id(ap->netdev);
|
||||||
struct iovec iov[2];
|
struct iovec iov[2];
|
||||||
|
|
||||||
@ -2318,7 +2319,7 @@ static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
|
|||||||
uint32_t nl_akm = CRYPTO_AKM_PSK;
|
uint32_t nl_akm = CRYPTO_AKM_PSK;
|
||||||
uint32_t wpa_version = NL80211_WPA_VERSION_2;
|
uint32_t wpa_version = NL80211_WPA_VERSION_2;
|
||||||
uint32_t auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
|
uint32_t auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM;
|
||||||
uint32_t ch_freq = scan_channel_to_freq(ap->channel, SCAN_BAND_2_4_GHZ);
|
uint32_t ch_freq = band_channel_to_freq(ap->channel, BAND_FREQ_2_4_GHZ);
|
||||||
uint32_t ch_width = NL80211_CHAN_WIDTH_20;
|
uint32_t ch_width = NL80211_CHAN_WIDTH_20;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -3066,8 +3067,8 @@ static int ap_load_config(struct ap_state *ap, const struct l_settings *config,
|
|||||||
|
|
||||||
if (!l_settings_get_uint(config, "General", "Channel",
|
if (!l_settings_get_uint(config, "General", "Channel",
|
||||||
&uintval) ||
|
&uintval) ||
|
||||||
!scan_channel_to_freq(uintval,
|
!band_channel_to_freq(uintval,
|
||||||
SCAN_BAND_2_4_GHZ)) {
|
BAND_FREQ_2_4_GHZ)) {
|
||||||
l_error("AP Channel value unsupported");
|
l_error("AP Channel value unsupported");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -4188,7 +4188,7 @@ int netdev_join_adhoc(struct netdev *netdev, const char *ssid,
|
|||||||
{
|
{
|
||||||
struct l_genl_msg *cmd;
|
struct l_genl_msg *cmd;
|
||||||
uint32_t ifindex = netdev->index;
|
uint32_t ifindex = netdev->index;
|
||||||
uint32_t ch_freq = scan_channel_to_freq(6, SCAN_BAND_2_4_GHZ);
|
uint32_t ch_freq = band_channel_to_freq(6, BAND_FREQ_2_4_GHZ);
|
||||||
uint32_t ch_type = NL80211_CHAN_HT20;
|
uint32_t ch_type = NL80211_CHAN_HT20;
|
||||||
|
|
||||||
if (netdev->type != NL80211_IFTYPE_ADHOC) {
|
if (netdev->type != NL80211_IFTYPE_ADHOC) {
|
||||||
|
35
src/p2p.c
35
src/p2p.c
@ -61,6 +61,7 @@
|
|||||||
#include "src/netconfig.h"
|
#include "src/netconfig.h"
|
||||||
#include "src/ap.h"
|
#include "src/ap.h"
|
||||||
#include "src/p2p.h"
|
#include "src/p2p.h"
|
||||||
|
#include "src/band.h"
|
||||||
|
|
||||||
struct p2p_device {
|
struct p2p_device {
|
||||||
uint64_t wdev_id;
|
uint64_t wdev_id;
|
||||||
@ -804,7 +805,7 @@ static void p2p_peer_frame_xchg(struct p2p_peer *peer, struct iovec *tx_body,
|
|||||||
memcpy(frame + 1, tx_body, sizeof(struct iovec) * iov_cnt);
|
memcpy(frame + 1, tx_body, sizeof(struct iovec) * iov_cnt);
|
||||||
|
|
||||||
freq = own_channel ?
|
freq = own_channel ?
|
||||||
scan_channel_to_freq(dev->listen_channel, SCAN_BAND_2_4_GHZ) :
|
band_channel_to_freq(dev->listen_channel, BAND_FREQ_2_4_GHZ) :
|
||||||
peer->bss->frequency;
|
peer->bss->frequency;
|
||||||
|
|
||||||
va_start(args, cb);
|
va_start(args, cb);
|
||||||
@ -2094,14 +2095,14 @@ static void p2p_add_freq_func(uint32_t freq, void *user_data)
|
|||||||
{
|
{
|
||||||
struct p2p_channel_entries *channel_entry = user_data;
|
struct p2p_channel_entries *channel_entry = user_data;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
|
|
||||||
if (channel_entry->n_channels >= MAX_CHANNELS)
|
if (channel_entry->n_channels >= MAX_CHANNELS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
channel = scan_freq_to_channel(freq, &band);
|
channel = band_freq_to_channel(freq, &band);
|
||||||
|
|
||||||
if (band != scan_oper_class_to_band((const uint8_t *) "XX\x4",
|
if (band != band_oper_class_to_band((const uint8_t *) "XX\x4",
|
||||||
channel_entry->oper_class))
|
channel_entry->oper_class))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2221,10 +2222,10 @@ static bool p2p_go_negotiation_confirm_cb(const struct mmpdu_header *mpdu,
|
|||||||
*/
|
*/
|
||||||
p2p_device_interface_create(dev);
|
p2p_device_interface_create(dev);
|
||||||
} else {
|
} else {
|
||||||
enum scan_band band = scan_oper_class_to_band(
|
enum band_freq band = band_oper_class_to_band(
|
||||||
(const uint8_t *) info.operating_channel.country,
|
(const uint8_t *) info.operating_channel.country,
|
||||||
info.operating_channel.oper_class);
|
info.operating_channel.oper_class);
|
||||||
uint32_t frequency = scan_channel_to_freq(
|
uint32_t frequency = band_channel_to_freq(
|
||||||
info.operating_channel.channel_num,
|
info.operating_channel.channel_num,
|
||||||
band);
|
band);
|
||||||
|
|
||||||
@ -2590,7 +2591,7 @@ static bool p2p_go_negotiation_resp_cb(const struct mmpdu_header *mpdu,
|
|||||||
int r;
|
int r;
|
||||||
struct iovec iov[16];
|
struct iovec iov[16];
|
||||||
int iov_len = 0;
|
int iov_len = 0;
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
uint32_t frequency;
|
uint32_t frequency;
|
||||||
|
|
||||||
l_debug("");
|
l_debug("");
|
||||||
@ -2743,10 +2744,10 @@ static bool p2p_go_negotiation_resp_cb(const struct mmpdu_header *mpdu,
|
|||||||
memcpy(&confirm_info.group_id, &dev->go_group_id,
|
memcpy(&confirm_info.group_id, &dev->go_group_id,
|
||||||
sizeof(struct p2p_group_id_attr));
|
sizeof(struct p2p_group_id_attr));
|
||||||
} else {
|
} else {
|
||||||
band = scan_oper_class_to_band(
|
band = band_oper_class_to_band(
|
||||||
(const uint8_t *) resp_info.operating_channel.country,
|
(const uint8_t *) resp_info.operating_channel.country,
|
||||||
resp_info.operating_channel.oper_class);
|
resp_info.operating_channel.oper_class);
|
||||||
frequency = scan_channel_to_freq(
|
frequency = band_channel_to_freq(
|
||||||
resp_info.operating_channel.channel_num,
|
resp_info.operating_channel.channel_num,
|
||||||
band);
|
band);
|
||||||
if (!frequency) {
|
if (!frequency) {
|
||||||
@ -3444,8 +3445,8 @@ static void p2p_device_roc_start(struct p2p_device *dev)
|
|||||||
* channel than on any other channel and then we listen for a
|
* channel than on any other channel and then we listen for a
|
||||||
* potential GO Negotiation restart on our listen channel.
|
* potential GO Negotiation restart on our listen channel.
|
||||||
*/
|
*/
|
||||||
listen_freq = scan_channel_to_freq(dev->listen_channel,
|
listen_freq = band_channel_to_freq(dev->listen_channel,
|
||||||
SCAN_BAND_2_4_GHZ);
|
BAND_FREQ_2_4_GHZ);
|
||||||
|
|
||||||
msg = l_genl_msg_new_sized(NL80211_CMD_REMAIN_ON_CHANNEL, 64);
|
msg = l_genl_msg_new_sized(NL80211_CMD_REMAIN_ON_CHANNEL, 64);
|
||||||
l_genl_msg_append_attr(msg, NL80211_ATTR_WDEV, 8, &dev->wdev_id);
|
l_genl_msg_append_attr(msg, NL80211_ATTR_WDEV, 8, &dev->wdev_id);
|
||||||
@ -3809,7 +3810,7 @@ static bool p2p_device_scan_start(struct p2p_device *dev)
|
|||||||
|
|
||||||
for (i = 0; i < L_ARRAY_SIZE(channels_social); i++) {
|
for (i = 0; i < L_ARRAY_SIZE(channels_social); i++) {
|
||||||
int chan = channels_social[i];
|
int chan = channels_social[i];
|
||||||
uint32_t freq = scan_channel_to_freq(chan, SCAN_BAND_2_4_GHZ);
|
uint32_t freq = band_channel_to_freq(chan, BAND_FREQ_2_4_GHZ);
|
||||||
|
|
||||||
scan_freq_set_add(params.freqs, freq);
|
scan_freq_set_add(params.freqs, freq);
|
||||||
}
|
}
|
||||||
@ -3826,7 +3827,7 @@ static bool p2p_device_scan_start(struct p2p_device *dev)
|
|||||||
for (i = 0; i < dev->chans_per_scan; i++) {
|
for (i = 0; i < dev->chans_per_scan; i++) {
|
||||||
int idx = dev->scan_chan_idx++;
|
int idx = dev->scan_chan_idx++;
|
||||||
int chan = channels_scan_2_4_other[idx];
|
int chan = channels_scan_2_4_other[idx];
|
||||||
uint32_t freq = scan_channel_to_freq(chan, SCAN_BAND_2_4_GHZ);
|
uint32_t freq = band_channel_to_freq(chan, BAND_FREQ_2_4_GHZ);
|
||||||
|
|
||||||
if (dev->scan_chan_idx >=
|
if (dev->scan_chan_idx >=
|
||||||
L_ARRAY_SIZE(channels_scan_2_4_other)) {
|
L_ARRAY_SIZE(channels_scan_2_4_other)) {
|
||||||
@ -3997,7 +3998,7 @@ static void p2p_device_send_probe_resp(struct p2p_device *dev,
|
|||||||
|
|
||||||
iov[iov_len].iov_base = NULL;
|
iov[iov_len].iov_base = NULL;
|
||||||
|
|
||||||
freq = scan_channel_to_freq(dev->listen_channel, SCAN_BAND_2_4_GHZ);
|
freq = band_channel_to_freq(dev->listen_channel, BAND_FREQ_2_4_GHZ);
|
||||||
frame_xchg_start(dev->wdev_id, iov, freq, 0, 0, false, 0,
|
frame_xchg_start(dev->wdev_id, iov, freq, 0, 0, false, 0,
|
||||||
p2p_probe_resp_done, dev, NULL, NULL);
|
p2p_probe_resp_done, dev, NULL, NULL);
|
||||||
l_debug("Probe Response tx queued");
|
l_debug("Probe Response tx queued");
|
||||||
@ -4019,7 +4020,7 @@ static void p2p_device_probe_cb(const struct mmpdu_header *mpdu,
|
|||||||
ssize_t wsc_len;
|
ssize_t wsc_len;
|
||||||
struct scan_bss *bss;
|
struct scan_bss *bss;
|
||||||
struct p2p_channel_attr *channel;
|
struct p2p_channel_attr *channel;
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
uint32_t frequency;
|
uint32_t frequency;
|
||||||
bool from_conn_peer;
|
bool from_conn_peer;
|
||||||
|
|
||||||
@ -4082,9 +4083,9 @@ static void p2p_device_probe_cb(const struct mmpdu_header *mpdu,
|
|||||||
else
|
else
|
||||||
goto p2p_free;
|
goto p2p_free;
|
||||||
|
|
||||||
band = scan_oper_class_to_band((const uint8_t *) channel->country,
|
band = band_oper_class_to_band((const uint8_t *) channel->country,
|
||||||
channel->oper_class);
|
channel->oper_class);
|
||||||
frequency = scan_channel_to_freq(channel->channel_num, band);
|
frequency = band_channel_to_freq(channel->channel_num, band);
|
||||||
if (!frequency)
|
if (!frequency)
|
||||||
goto p2p_free;
|
goto p2p_free;
|
||||||
|
|
||||||
|
11
src/rrm.c
11
src/rrm.c
@ -41,6 +41,7 @@
|
|||||||
#include "src/nl80211util.h"
|
#include "src/nl80211util.h"
|
||||||
#include "src/wiphy.h"
|
#include "src/wiphy.h"
|
||||||
#include "src/frame-xchg.h"
|
#include "src/frame-xchg.h"
|
||||||
|
#include "src/band.h"
|
||||||
|
|
||||||
#include "linux/nl80211.h"
|
#include "linux/nl80211.h"
|
||||||
|
|
||||||
@ -278,7 +279,7 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
|
|||||||
struct rrm_beacon_report *report = (struct rrm_beacon_report *) to;
|
struct rrm_beacon_report *report = (struct rrm_beacon_report *) to;
|
||||||
|
|
||||||
report->oper_class = beacon->oper_class;
|
report->oper_class = beacon->oper_class;
|
||||||
report->channel = scan_freq_to_channel(bss->frequency, NULL);
|
report->channel = band_freq_to_channel(bss->frequency, NULL);
|
||||||
report->scan_start_time = L_CPU_TO_LE64(beacon->scan_start_time);
|
report->scan_start_time = L_CPU_TO_LE64(beacon->scan_start_time);
|
||||||
report->duration = L_CPU_TO_LE16(beacon->duration);
|
report->duration = L_CPU_TO_LE16(beacon->duration);
|
||||||
report->frame_info = rrm_phy_type(bss);
|
report->frame_info = rrm_phy_type(bss);
|
||||||
@ -310,7 +311,7 @@ static size_t build_report_for_bss(struct rrm_beacon_req_info *beacon,
|
|||||||
static bool bss_in_request_range(struct rrm_beacon_req_info *beacon,
|
static bool bss_in_request_range(struct rrm_beacon_req_info *beacon,
|
||||||
struct scan_bss *bss)
|
struct scan_bss *bss)
|
||||||
{
|
{
|
||||||
uint8_t channel = scan_freq_to_channel(bss->frequency, NULL);
|
uint8_t channel = band_freq_to_channel(bss->frequency, NULL);
|
||||||
|
|
||||||
/* Must be a table measurement */
|
/* Must be a table measurement */
|
||||||
if (beacon->channel == 0 || beacon->channel == 255)
|
if (beacon->channel == 0 || beacon->channel == 255)
|
||||||
@ -436,10 +437,10 @@ static void rrm_handle_beacon_scan(struct rrm_state *rrm,
|
|||||||
.duration = beacon->duration,
|
.duration = beacon->duration,
|
||||||
.duration_mandatory = test_bit(&beacon->info.mode, 4),
|
.duration_mandatory = test_bit(&beacon->info.mode, 4),
|
||||||
};
|
};
|
||||||
enum scan_band band = scan_oper_class_to_band(NULL, beacon->oper_class);
|
enum band_freq band = band_oper_class_to_band(NULL, beacon->oper_class);
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
|
|
||||||
freq = scan_channel_to_freq(beacon->channel, band);
|
freq = band_channel_to_freq(beacon->channel, band);
|
||||||
scan_freq_set_add(freqs, freq);
|
scan_freq_set_add(freqs, freq);
|
||||||
|
|
||||||
if (passive)
|
if (passive)
|
||||||
@ -485,7 +486,7 @@ static bool rrm_verify_beacon_request(const uint8_t *request, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check this is a valid operating class */
|
/* Check this is a valid operating class */
|
||||||
if (!scan_oper_class_to_band(NULL, request[0]))
|
if (!band_oper_class_to_band(NULL, request[0]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
24
src/scan.c
24
src/scan.c
@ -2233,18 +2233,18 @@ void scan_freq_set_free(struct scan_freq_set *freqs)
|
|||||||
|
|
||||||
bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq)
|
bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq)
|
||||||
{
|
{
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
|
|
||||||
channel = scan_freq_to_channel(freq, &band);
|
channel = band_freq_to_channel(freq, &band);
|
||||||
if (!channel)
|
if (!channel)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (band) {
|
switch (band) {
|
||||||
case SCAN_BAND_2_4_GHZ:
|
case BAND_FREQ_2_4_GHZ:
|
||||||
freqs->channels_2ghz |= 1 << (channel - 1);
|
freqs->channels_2ghz |= 1 << (channel - 1);
|
||||||
return true;
|
return true;
|
||||||
case SCAN_BAND_5_GHZ:
|
case BAND_FREQ_5_GHZ:
|
||||||
return l_uintset_put(freqs->channels_5ghz, channel);
|
return l_uintset_put(freqs->channels_5ghz, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2253,17 +2253,17 @@ bool scan_freq_set_add(struct scan_freq_set *freqs, uint32_t freq)
|
|||||||
|
|
||||||
bool scan_freq_set_contains(const struct scan_freq_set *freqs, uint32_t freq)
|
bool scan_freq_set_contains(const struct scan_freq_set *freqs, uint32_t freq)
|
||||||
{
|
{
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
uint8_t channel;
|
uint8_t channel;
|
||||||
|
|
||||||
channel = scan_freq_to_channel(freq, &band);
|
channel = band_freq_to_channel(freq, &band);
|
||||||
if (!channel)
|
if (!channel)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (band) {
|
switch (band) {
|
||||||
case SCAN_BAND_2_4_GHZ:
|
case BAND_FREQ_2_4_GHZ:
|
||||||
return freqs->channels_2ghz & (1 << (channel - 1));
|
return freqs->channels_2ghz & (1 << (channel - 1));
|
||||||
case SCAN_BAND_5_GHZ:
|
case BAND_FREQ_5_GHZ:
|
||||||
return l_uintset_contains(freqs->channels_5ghz, channel);
|
return l_uintset_contains(freqs->channels_5ghz, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2276,12 +2276,12 @@ uint32_t scan_freq_set_get_bands(struct scan_freq_set *freqs)
|
|||||||
uint32_t max;
|
uint32_t max;
|
||||||
|
|
||||||
if (freqs->channels_2ghz)
|
if (freqs->channels_2ghz)
|
||||||
bands |= SCAN_BAND_2_4_GHZ;
|
bands |= BAND_FREQ_2_4_GHZ;
|
||||||
|
|
||||||
max = l_uintset_get_max(freqs->channels_5ghz);
|
max = l_uintset_get_max(freqs->channels_5ghz);
|
||||||
|
|
||||||
if (l_uintset_find_min(freqs->channels_5ghz) <= max)
|
if (l_uintset_find_min(freqs->channels_5ghz) <= max)
|
||||||
bands |= SCAN_BAND_5_GHZ;
|
bands |= BAND_FREQ_5_GHZ;
|
||||||
|
|
||||||
return bands;
|
return bands;
|
||||||
}
|
}
|
||||||
@ -2320,7 +2320,7 @@ static void scan_channels_5ghz_frequency(uint32_t channel, void *user_data)
|
|||||||
const struct channels_5ghz_foreach_data *channels_5ghz_data = user_data;
|
const struct channels_5ghz_foreach_data *channels_5ghz_data = user_data;
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
|
|
||||||
freq = scan_channel_to_freq(channel, SCAN_BAND_5_GHZ);
|
freq = band_channel_to_freq(channel, BAND_FREQ_5_GHZ);
|
||||||
|
|
||||||
channels_5ghz_data->func(freq, channels_5ghz_data->user_data);
|
channels_5ghz_data->func(freq, channels_5ghz_data->user_data);
|
||||||
}
|
}
|
||||||
@ -2346,7 +2346,7 @@ void scan_freq_set_foreach(const struct scan_freq_set *freqs,
|
|||||||
|
|
||||||
for (channel = 1; channel <= 14; channel++) {
|
for (channel = 1; channel <= 14; channel++) {
|
||||||
if (freqs->channels_2ghz & (1 << (channel - 1))) {
|
if (freqs->channels_2ghz & (1 << (channel - 1))) {
|
||||||
freq = scan_channel_to_freq(channel, SCAN_BAND_2_4_GHZ);
|
freq = band_channel_to_freq(channel, BAND_FREQ_2_4_GHZ);
|
||||||
|
|
||||||
func(freq, user_data);
|
func(freq, user_data);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
#include "src/diagnostic.h"
|
#include "src/diagnostic.h"
|
||||||
#include "src/frame-xchg.h"
|
#include "src/frame-xchg.h"
|
||||||
#include "src/sysfs.h"
|
#include "src/sysfs.h"
|
||||||
|
#include "src/band.h"
|
||||||
|
|
||||||
static struct l_queue *station_list;
|
static struct l_queue *station_list;
|
||||||
static uint32_t netdev_watch;
|
static uint32_t netdev_watch;
|
||||||
@ -1646,9 +1647,9 @@ static int station_roam_scan(struct station *station,
|
|||||||
struct scan_freq_set *freq_set);
|
struct scan_freq_set *freq_set);
|
||||||
|
|
||||||
static uint32_t station_freq_from_neighbor_report(const uint8_t *country,
|
static uint32_t station_freq_from_neighbor_report(const uint8_t *country,
|
||||||
struct ie_neighbor_report_info *info, enum scan_band *out_band)
|
struct ie_neighbor_report_info *info, enum band_freq *out_band)
|
||||||
{
|
{
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
|
|
||||||
if (info->oper_class == 0) {
|
if (info->oper_class == 0) {
|
||||||
@ -1660,9 +1661,9 @@ static uint32_t station_freq_from_neighbor_report(const uint8_t *country,
|
|||||||
* use channels in two disjoint ranges.
|
* use channels in two disjoint ranges.
|
||||||
*/
|
*/
|
||||||
if (info->channel_num >= 1 && info->channel_num <= 14)
|
if (info->channel_num >= 1 && info->channel_num <= 14)
|
||||||
band = SCAN_BAND_2_4_GHZ;
|
band = BAND_FREQ_2_4_GHZ;
|
||||||
else if (info->channel_num >= 36 && info->channel_num <= 169)
|
else if (info->channel_num >= 36 && info->channel_num <= 169)
|
||||||
band = SCAN_BAND_5_GHZ;
|
band = BAND_FREQ_5_GHZ;
|
||||||
else {
|
else {
|
||||||
l_debug("Ignored: 0 oper class with an unusual "
|
l_debug("Ignored: 0 oper class with an unusual "
|
||||||
"channel number");
|
"channel number");
|
||||||
@ -1670,7 +1671,7 @@ static uint32_t station_freq_from_neighbor_report(const uint8_t *country,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
band = scan_oper_class_to_band(country, info->oper_class);
|
band = band_oper_class_to_band(country, info->oper_class);
|
||||||
if (!band) {
|
if (!band) {
|
||||||
l_debug("Ignored: unsupported oper class");
|
l_debug("Ignored: unsupported oper class");
|
||||||
|
|
||||||
@ -1678,7 +1679,7 @@ static uint32_t station_freq_from_neighbor_report(const uint8_t *country,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
freq = scan_channel_to_freq(info->channel_num, band);
|
freq = band_channel_to_freq(info->channel_num, band);
|
||||||
if (!freq) {
|
if (!freq) {
|
||||||
l_debug("Ignored: unsupported channel");
|
l_debug("Ignored: unsupported channel");
|
||||||
|
|
||||||
@ -1711,7 +1712,7 @@ static void parse_neighbor_report(struct station *station,
|
|||||||
while (ie_tlv_iter_next(&iter)) {
|
while (ie_tlv_iter_next(&iter)) {
|
||||||
struct ie_neighbor_report_info info;
|
struct ie_neighbor_report_info info;
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
const uint8_t *cc = NULL;
|
const uint8_t *cc = NULL;
|
||||||
|
|
||||||
if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_NEIGHBOR_REPORT)
|
if (ie_tlv_iter_get_tag(&iter) != IE_TYPE_NEIGHBOR_REPORT)
|
||||||
|
12
src/wiphy.c
12
src/wiphy.c
@ -431,10 +431,10 @@ uint32_t wiphy_get_supported_bands(struct wiphy *wiphy)
|
|||||||
uint32_t bands = 0;
|
uint32_t bands = 0;
|
||||||
|
|
||||||
if (wiphy->band_2g)
|
if (wiphy->band_2g)
|
||||||
bands |= SCAN_BAND_2_4_GHZ;
|
bands |= BAND_FREQ_2_4_GHZ;
|
||||||
|
|
||||||
if (wiphy->band_5g)
|
if (wiphy->band_5g)
|
||||||
bands |= SCAN_BAND_5_GHZ;
|
bands |= BAND_FREQ_5_GHZ;
|
||||||
|
|
||||||
return bands;
|
return bands;
|
||||||
}
|
}
|
||||||
@ -777,16 +777,16 @@ int wiphy_estimate_data_rate(struct wiphy *wiphy,
|
|||||||
const void *ht_capabilities = NULL;
|
const void *ht_capabilities = NULL;
|
||||||
const void *ht_operation = NULL;
|
const void *ht_operation = NULL;
|
||||||
const struct band *bandp;
|
const struct band *bandp;
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
|
|
||||||
if (scan_freq_to_channel(bss->frequency, &band) == 0)
|
if (band_freq_to_channel(bss->frequency, &band) == 0)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
switch (band) {
|
switch (band) {
|
||||||
case SCAN_BAND_2_4_GHZ:
|
case BAND_FREQ_2_4_GHZ:
|
||||||
bandp = wiphy->band_2g;
|
bandp = wiphy->band_2g;
|
||||||
break;
|
break;
|
||||||
case SCAN_BAND_5_GHZ:
|
case BAND_FREQ_5_GHZ:
|
||||||
bandp = wiphy->band_5g;
|
bandp = wiphy->band_5g;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
21
src/wsc.c
21
src/wsc.c
@ -46,6 +46,7 @@
|
|||||||
#include "src/iwd.h"
|
#include "src/iwd.h"
|
||||||
#include "src/network.h"
|
#include "src/network.h"
|
||||||
#include "src/wsc.h"
|
#include "src/wsc.h"
|
||||||
|
#include "src/band.h"
|
||||||
|
|
||||||
#define WALK_TIME 120
|
#define WALK_TIME 120
|
||||||
|
|
||||||
@ -299,14 +300,14 @@ static void wsc_enrollee_handshake_event(struct handshake_state *hs,
|
|||||||
|
|
||||||
static inline enum wsc_rf_band freq_to_rf_band(uint32_t freq)
|
static inline enum wsc_rf_band freq_to_rf_band(uint32_t freq)
|
||||||
{
|
{
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
|
|
||||||
scan_freq_to_channel(freq, &band);
|
band_freq_to_channel(freq, &band);
|
||||||
|
|
||||||
switch (band) {
|
switch (band) {
|
||||||
case SCAN_BAND_2_4_GHZ:
|
case BAND_FREQ_2_4_GHZ:
|
||||||
return WSC_RF_BAND_2_4_GHZ;
|
return WSC_RF_BAND_2_4_GHZ;
|
||||||
case SCAN_BAND_5_GHZ:
|
case BAND_FREQ_5_GHZ:
|
||||||
return WSC_RF_BAND_5_0_GHZ;
|
return WSC_RF_BAND_5_0_GHZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -731,7 +732,7 @@ static bool push_button_scan_results(int err, struct l_queue *bss_list,
|
|||||||
for (bss_entry = l_queue_get_entries(bss_list); bss_entry;
|
for (bss_entry = l_queue_get_entries(bss_list); bss_entry;
|
||||||
bss_entry = bss_entry->next) {
|
bss_entry = bss_entry->next) {
|
||||||
struct scan_bss *bss = bss_entry->data;
|
struct scan_bss *bss = bss_entry->data;
|
||||||
enum scan_band band;
|
enum band_freq band;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
l_debug("bss '%s' with SSID: %s, freq: %u",
|
l_debug("bss '%s' with SSID: %s, freq: %u",
|
||||||
@ -762,10 +763,10 @@ static bool push_button_scan_results(int err, struct l_queue *bss_list,
|
|||||||
WSC_DEVICE_PASSWORD_ID_PUSH_BUTTON)
|
WSC_DEVICE_PASSWORD_ID_PUSH_BUTTON)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
scan_freq_to_channel(bss->frequency, &band);
|
band_freq_to_channel(bss->frequency, &band);
|
||||||
|
|
||||||
switch (band) {
|
switch (band) {
|
||||||
case SCAN_BAND_2_4_GHZ:
|
case BAND_FREQ_2_4_GHZ:
|
||||||
if (bss_2g) {
|
if (bss_2g) {
|
||||||
l_debug("2G Session overlap error");
|
l_debug("2G Session overlap error");
|
||||||
goto session_overlap;
|
goto session_overlap;
|
||||||
@ -775,7 +776,7 @@ static bool push_button_scan_results(int err, struct l_queue *bss_list,
|
|||||||
memcpy(uuid_2g, probe_response.uuid_e, 16);
|
memcpy(uuid_2g, probe_response.uuid_e, 16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCAN_BAND_5_GHZ:
|
case BAND_FREQ_5_GHZ:
|
||||||
if (bss_5g) {
|
if (bss_5g) {
|
||||||
l_debug("5G Session overlap error");
|
l_debug("5G Session overlap error");
|
||||||
goto session_overlap;
|
goto session_overlap;
|
||||||
@ -994,9 +995,9 @@ static bool wsc_initiate_scan(struct wsc_station_dbus *wsc,
|
|||||||
req.primary_device_type.subcategory = 0;
|
req.primary_device_type.subcategory = 0;
|
||||||
|
|
||||||
bands = wiphy_get_supported_bands(wiphy);
|
bands = wiphy_get_supported_bands(wiphy);
|
||||||
if (bands & SCAN_BAND_2_4_GHZ)
|
if (bands & BAND_FREQ_2_4_GHZ)
|
||||||
req.rf_bands |= WSC_RF_BAND_2_4_GHZ;
|
req.rf_bands |= WSC_RF_BAND_2_4_GHZ;
|
||||||
if (bands & SCAN_BAND_5_GHZ)
|
if (bands & BAND_FREQ_5_GHZ)
|
||||||
req.rf_bands |= WSC_RF_BAND_5_0_GHZ;
|
req.rf_bands |= WSC_RF_BAND_5_0_GHZ;
|
||||||
|
|
||||||
req.association_state = WSC_ASSOCIATION_STATE_NOT_ASSOCIATED;
|
req.association_state = WSC_ASSOCIATION_STATE_NOT_ASSOCIATED;
|
||||||
|
Loading…
Reference in New Issue
Block a user