aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap/hostapd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ap/hostapd.c')
-rw-r--r--src/ap/hostapd.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 3406cd1..4e06808 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1106,3 +1106,34 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
ap_handle_timer, hapd, sta);
}
+
+struct
+hostapd_channel_data *hostapd_get_valid_channel(struct hostapd_data *hapd,
+ int req_freq)
+{
+ struct hostapd_hw_modes *mode;
+ struct hostapd_channel_data *chan;
+ int i, channel_idx = 0;
+
+ wpa_printf(MSG_DEBUG, "Selecting next channel");
+
+ if (hapd->iface->current_mode == NULL)
+ return NULL;
+
+ mode = hapd->iface->current_mode;
+
+ for (i = 0; i < mode->num_channels; i++) {
+ chan = &mode->channels[i];
+
+ if (chan->flag & (HOSTAPD_CHAN_DISABLED | HOSTAPD_CHAN_RADAR))
+ continue;
+ channel_idx++;
+
+ /* request specific channel */
+ if (req_freq && (req_freq == chan->freq))
+ return chan;
+ }
+
+ wpa_printf(MSG_WARNING, "Could't get requested channel");
+ return NULL;
+}