Changed channel flags configuration to read the information from the driver
(e.g., via driver_nl80211 when using mac80211) instead of using hostapd as the source of the regulatory information (i.e., information from CRDA is now used with mac80211); this allows 5 GHz channels to be used with hostapd (if allowed in the current regulatory domain).
This commit is contained in:
parent
0cf03892a4
commit
10b83bd712
7 changed files with 46 additions and 58 deletions
|
@ -8,6 +8,12 @@ ChangeLog for hostapd
|
|||
session ticket overriding API that was included into the upstream
|
||||
OpenSSL 0.9.9 tree on 2008-11-15 (no additional OpenSSL patch is
|
||||
needed with that version anymore)
|
||||
* changed channel flags configuration to read the information from
|
||||
the driver (e.g., via driver_nl80211 when using mac80211) instead of
|
||||
using hostapd as the source of the regulatory information (i.e.,
|
||||
information from CRDA is now used with mac80211); this allows 5 GHz
|
||||
channels to be used with hostapd (if allowed in the current
|
||||
regulatory domain)
|
||||
|
||||
2008-11-01 - v0.6.5
|
||||
* added support for SHA-256 as X.509 certificate digest when using the
|
||||
|
|
|
@ -111,9 +111,6 @@ struct wpa_driver_ops {
|
|||
int total_flags, int flags_or, int flags_and);
|
||||
int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
|
||||
int mode);
|
||||
int (*set_channel_flag)(void *priv, int mode, int chan, int flag,
|
||||
unsigned char power_level,
|
||||
unsigned char antenna_max);
|
||||
int (*set_regulatory_domain)(void *priv, unsigned int rd);
|
||||
int (*set_country)(void *priv, const char *country);
|
||||
int (*set_ieee80211d)(void *priv, int enabled);
|
||||
|
@ -497,17 +494,6 @@ hostapd_set_rate_sets(struct hostapd_data *hapd, int *supp_rates,
|
|||
basic_rates, mode);
|
||||
}
|
||||
|
||||
static inline int
|
||||
hostapd_set_channel_flag(struct hostapd_data *hapd, int mode, int chan,
|
||||
int flag, unsigned char power_level,
|
||||
unsigned char antenna_max)
|
||||
{
|
||||
if (hapd->driver == NULL || hapd->driver->set_channel_flag == NULL)
|
||||
return 0;
|
||||
return hapd->driver->set_channel_flag(hapd->drv_priv, mode, chan, flag,
|
||||
power_level, antenna_max);
|
||||
}
|
||||
|
||||
static inline int
|
||||
hostapd_set_regulatory_domain(struct hostapd_data *hapd, unsigned int rd)
|
||||
{
|
||||
|
|
|
@ -1203,6 +1203,9 @@ static struct hostapd_hw_modes * hostap_get_hw_feature_data(void *priv,
|
|||
for (i = 0; i < 14; i++) {
|
||||
mode->channels[i].chan = i + 1;
|
||||
mode->channels[i].freq = chan2freq[i];
|
||||
/* TODO: Get allowed channel list from the driver */
|
||||
if (i >= 11)
|
||||
mode->channels[i].flag = HOSTAPD_CHAN_DISABLED;
|
||||
}
|
||||
|
||||
mode->rates[0].rate = 10;
|
||||
|
|
|
@ -881,14 +881,6 @@ static int i802_sta_set_flags(void *priv, const u8 *addr,
|
|||
}
|
||||
|
||||
|
||||
static int i802_set_channel_flag(void *priv, int mode, int chan, int flag,
|
||||
unsigned char power_level,
|
||||
unsigned char antenna_max)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static int i802_set_regulatory_domain(void *priv, unsigned int rd)
|
||||
{
|
||||
return -1;
|
||||
|
@ -1381,9 +1373,7 @@ static int phy_info_handler(struct nl_msg *msg, void *arg)
|
|||
continue;
|
||||
|
||||
mode->channels[idx].freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]);
|
||||
mode->channels[idx].flag |= HOSTAPD_CHAN_W_SCAN |
|
||||
HOSTAPD_CHAN_W_ACTIVE_SCAN |
|
||||
HOSTAPD_CHAN_W_IBSS;
|
||||
mode->channels[idx].flag = 0;
|
||||
|
||||
if (!mode_is_set) {
|
||||
/* crude heuristic */
|
||||
|
@ -1404,11 +1394,17 @@ static int phy_info_handler(struct nl_msg *msg, void *arg)
|
|||
mode->channels[idx].chan = mode->channels[idx].freq/5 - 1000;
|
||||
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
|
||||
mode->channels[idx].flag &= ~HOSTAPD_CHAN_W_SCAN;
|
||||
mode->channels[idx].flag |=
|
||||
HOSTAPD_CHAN_DISABLED;
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN])
|
||||
mode->channels[idx].flag &= ~HOSTAPD_CHAN_W_ACTIVE_SCAN;
|
||||
mode->channels[idx].flag |=
|
||||
HOSTAPD_CHAN_PASSIVE_SCAN;
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS])
|
||||
mode->channels[idx].flag &= ~HOSTAPD_CHAN_W_IBSS;
|
||||
mode->channels[idx].flag |=
|
||||
HOSTAPD_CHAN_NO_IBSS;
|
||||
if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR])
|
||||
mode->channels[idx].flag |=
|
||||
HOSTAPD_CHAN_RADAR;
|
||||
idx++;
|
||||
}
|
||||
|
||||
|
@ -2375,7 +2371,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
|||
.set_retry = i802_set_retry,
|
||||
.get_retry = i802_get_retry,
|
||||
.set_rate_sets = i802_set_rate_sets,
|
||||
.set_channel_flag = i802_set_channel_flag,
|
||||
.set_regulatory_domain = i802_set_regulatory_domain,
|
||||
.set_beacon = i802_set_beacon,
|
||||
.set_internal_bridge = i802_set_internal_bridge,
|
||||
|
|
|
@ -785,8 +785,7 @@ test_driver_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
|
|||
}
|
||||
modes[0].channels[0].chan = 1;
|
||||
modes[0].channels[0].freq = 2412;
|
||||
modes[0].channels[0].flag = HOSTAPD_CHAN_W_SCAN |
|
||||
HOSTAPD_CHAN_W_ACTIVE_SCAN;
|
||||
modes[0].channels[0].flag = 0;
|
||||
modes[0].rates[0].rate = 10;
|
||||
modes[0].rates[0].flags = HOSTAPD_RATE_BASIC | HOSTAPD_RATE_SUPPORTED |
|
||||
HOSTAPD_RATE_CCK | HOSTAPD_RATE_MANDATORY;
|
||||
|
@ -802,8 +801,7 @@ test_driver_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
|
|||
}
|
||||
modes[1].channels[0].chan = 1;
|
||||
modes[1].channels[0].freq = 2412;
|
||||
modes[1].channels[0].flag = HOSTAPD_CHAN_W_SCAN |
|
||||
HOSTAPD_CHAN_W_ACTIVE_SCAN;
|
||||
modes[1].channels[0].flag = 0;
|
||||
modes[1].rates[0].rate = 10;
|
||||
modes[1].rates[0].flags = HOSTAPD_RATE_BASIC | HOSTAPD_RATE_SUPPORTED |
|
||||
HOSTAPD_RATE_CCK | HOSTAPD_RATE_MANDATORY;
|
||||
|
@ -819,8 +817,7 @@ test_driver_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
|
|||
}
|
||||
modes[2].channels[0].chan = 60;
|
||||
modes[2].channels[0].freq = 5300;
|
||||
modes[2].channels[0].flag = HOSTAPD_CHAN_W_SCAN |
|
||||
HOSTAPD_CHAN_W_ACTIVE_SCAN;
|
||||
modes[2].channels[0].flag = 0;
|
||||
modes[2].rates[0].rate = 60;
|
||||
modes[2].rates[0].flags = HOSTAPD_RATE_BASIC | HOSTAPD_RATE_SUPPORTED |
|
||||
HOSTAPD_RATE_MANDATORY;
|
||||
|
|
|
@ -68,26 +68,26 @@ int hostapd_get_hw_features(struct hostapd_iface *iface)
|
|||
/* set flag for channels we can use in current regulatory
|
||||
* domain */
|
||||
for (j = 0; j < feature->num_channels; j++) {
|
||||
/* TODO: add regulatory domain lookup */
|
||||
unsigned char power_level = 0;
|
||||
unsigned char antenna_max = 0;
|
||||
|
||||
if ((feature->mode == HOSTAPD_MODE_IEEE80211G ||
|
||||
feature->mode == HOSTAPD_MODE_IEEE80211B) &&
|
||||
feature->channels[j].chan >= 1 &&
|
||||
feature->channels[j].chan <= 11) {
|
||||
power_level = 20;
|
||||
/*
|
||||
* Disable all channels that are marked not to allow
|
||||
* IBSS operation or active scanning. In addition,
|
||||
* disable all channels that require radar detection,
|
||||
* since that (in addition to full DFS) is not yet
|
||||
* supported.
|
||||
*/
|
||||
if (feature->channels[j].flag &
|
||||
(HOSTAPD_CHAN_NO_IBSS |
|
||||
HOSTAPD_CHAN_PASSIVE_SCAN |
|
||||
HOSTAPD_CHAN_RADAR))
|
||||
feature->channels[j].flag |=
|
||||
HOSTAPD_CHAN_W_SCAN;
|
||||
} else
|
||||
feature->channels[j].flag &=
|
||||
~HOSTAPD_CHAN_W_SCAN;
|
||||
|
||||
hostapd_set_channel_flag(hapd, feature->mode,
|
||||
feature->channels[j].chan,
|
||||
feature->channels[j].flag,
|
||||
power_level,
|
||||
antenna_max);
|
||||
HOSTAPD_CHAN_DISABLED;
|
||||
if (feature->channels[j].flag & HOSTAPD_CHAN_DISABLED)
|
||||
continue;
|
||||
wpa_printf(MSG_MSGDUMP, "Allowed channel: mode=%d "
|
||||
"chan=%d freq=%d MHz",
|
||||
feature->mode,
|
||||
feature->channels[j].chan,
|
||||
feature->channels[j].freq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ static int select_hw_mode1(struct hostapd_iface *iface)
|
|||
for (j = 0; j < iface->current_mode->num_channels; j++) {
|
||||
struct hostapd_channel_data *chan =
|
||||
&iface->current_mode->channels[j];
|
||||
if ((chan->flag & HOSTAPD_CHAN_W_SCAN) &&
|
||||
if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
|
||||
(chan->chan == iface->conf->channel)) {
|
||||
ok = 1;
|
||||
break;
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
#ifndef HW_FEATURES_H
|
||||
#define HW_FEATURES_H
|
||||
|
||||
#define HOSTAPD_CHAN_W_SCAN 0x00000001
|
||||
#define HOSTAPD_CHAN_W_ACTIVE_SCAN 0x00000002
|
||||
#define HOSTAPD_CHAN_W_IBSS 0x00000004
|
||||
#define HOSTAPD_CHAN_DISABLED 0x00000001
|
||||
#define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
|
||||
#define HOSTAPD_CHAN_NO_IBSS 0x00000004
|
||||
#define HOSTAPD_CHAN_RADAR 0x00000008
|
||||
|
||||
struct hostapd_channel_data {
|
||||
short chan; /* channel number (IEEE 802.11) */
|
||||
|
|
Loading…
Reference in a new issue