Share same hw_feature definitions between hostapd and wpa_supplicant
This commit is contained in:
parent
0892aaaf51
commit
6caf9ca68c
11 changed files with 89 additions and 127 deletions
|
@ -213,4 +213,48 @@ enum mfp_options {
|
|||
IEEE80211W_REQUIRED = 2
|
||||
};
|
||||
|
||||
|
||||
/* Hardware features */
|
||||
|
||||
#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) */
|
||||
short freq; /* frequency in MHz */
|
||||
int flag; /* flag for hostapd use (HOSTAPD_CHAN_*) */
|
||||
u8 max_tx_power; /* maximum transmit power in dBm */
|
||||
};
|
||||
|
||||
#define HOSTAPD_RATE_ERP 0x00000001
|
||||
#define HOSTAPD_RATE_BASIC 0x00000002
|
||||
#define HOSTAPD_RATE_PREAMBLE2 0x00000004
|
||||
#define HOSTAPD_RATE_SUPPORTED 0x00000010
|
||||
#define HOSTAPD_RATE_OFDM 0x00000020
|
||||
#define HOSTAPD_RATE_CCK 0x00000040
|
||||
#define HOSTAPD_RATE_MANDATORY 0x00000100
|
||||
|
||||
struct hostapd_rate_data {
|
||||
int rate; /* rate in 100 kbps */
|
||||
int flags; /* HOSTAPD_RATE_ flags */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
HOSTAPD_MODE_IEEE80211B,
|
||||
HOSTAPD_MODE_IEEE80211G,
|
||||
HOSTAPD_MODE_IEEE80211A,
|
||||
NUM_HOSTAPD_MODES
|
||||
} hostapd_hw_mode;
|
||||
|
||||
struct hostapd_hw_modes {
|
||||
hostapd_hw_mode mode;
|
||||
int num_channels;
|
||||
struct hostapd_channel_data *channels;
|
||||
int num_rates;
|
||||
struct hostapd_rate_data *rates;
|
||||
u16 ht_capab;
|
||||
};
|
||||
|
||||
#endif /* DEFS_H */
|
||||
|
|
|
@ -411,45 +411,6 @@ struct wpa_driver_capa {
|
|||
};
|
||||
|
||||
|
||||
#define WPA_CHAN_W_SCAN 0x00000001
|
||||
#define WPA_CHAN_W_ACTIVE_SCAN 0x00000002
|
||||
#define WPA_CHAN_W_IBSS 0x00000004
|
||||
|
||||
struct wpa_channel_data {
|
||||
short chan; /* channel number (IEEE 802.11) */
|
||||
short freq; /* frequency in MHz */
|
||||
int flag; /* flag for user space use (WPA_CHAN_*) */
|
||||
};
|
||||
|
||||
#define WPA_RATE_ERP 0x00000001
|
||||
#define WPA_RATE_BASIC 0x00000002
|
||||
#define WPA_RATE_PREAMBLE2 0x00000004
|
||||
#define WPA_RATE_SUPPORTED 0x00000010
|
||||
#define WPA_RATE_OFDM 0x00000020
|
||||
#define WPA_RATE_CCK 0x00000040
|
||||
#define WPA_RATE_MANDATORY 0x00000100
|
||||
|
||||
struct wpa_rate_data {
|
||||
int rate; /* rate in 100 kbps */
|
||||
int flags; /* WPA_RATE_ flags */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
WPA_MODE_IEEE80211B,
|
||||
WPA_MODE_IEEE80211G,
|
||||
WPA_MODE_IEEE80211A,
|
||||
NUM_WPA_MODES
|
||||
} wpa_hw_mode;
|
||||
|
||||
struct wpa_hw_modes {
|
||||
wpa_hw_mode mode;
|
||||
int num_channels;
|
||||
struct wpa_channel_data *channels;
|
||||
int num_rates;
|
||||
struct wpa_rate_data *rates;
|
||||
};
|
||||
|
||||
|
||||
struct ieee80211_rx_status {
|
||||
int channel;
|
||||
int ssi;
|
||||
|
@ -910,14 +871,14 @@ struct wpa_driver_ops {
|
|||
* This function is only needed for drivers that export MLME
|
||||
* (management frame processing) to wpa_supplicant.
|
||||
*/
|
||||
struct wpa_hw_modes * (*get_hw_feature_data)(void *priv,
|
||||
u16 *num_modes,
|
||||
u16 *flags);
|
||||
struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
|
||||
u16 *num_modes,
|
||||
u16 *flags);
|
||||
|
||||
/**
|
||||
* set_channel - Set channel
|
||||
* @priv: Private driver interface data
|
||||
* @phymode: WPA_MODE_IEEE80211B, ..
|
||||
* @phymode: HOSTAPD_MODE_IEEE80211B, ..
|
||||
* @chan: IEEE 802.11 channel number
|
||||
* @freq: Frequency of the channel in MHz
|
||||
* Returns: 0 on success, -1 on failure
|
||||
|
@ -925,7 +886,7 @@ struct wpa_driver_ops {
|
|||
* This function is only needed for drivers that export MLME
|
||||
* (management frame processing) to wpa_supplicant.
|
||||
*/
|
||||
int (*set_channel)(void *priv, wpa_hw_mode phymode, int chan,
|
||||
int (*set_channel)(void *priv, hostapd_hw_mode phymode, int chan,
|
||||
int freq);
|
||||
|
||||
/**
|
||||
|
@ -1524,7 +1485,7 @@ void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
|
|||
|
||||
void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
|
||||
struct ieee80211_rx_status *rx_status);
|
||||
void wpa_supplicant_sta_free_hw_features(struct wpa_hw_modes *hw_features,
|
||||
void wpa_supplicant_sta_free_hw_features(struct hostapd_hw_modes *hw_features,
|
||||
size_t num_hw_features);
|
||||
|
||||
const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
|
||||
|
|
|
@ -1047,37 +1047,37 @@ static int wpa_driver_test_mlme_setprotection(void *priv, const u8 *addr,
|
|||
|
||||
|
||||
#ifdef CONFIG_CLIENT_MLME
|
||||
static struct wpa_hw_modes *
|
||||
static struct hostapd_hw_modes *
|
||||
wpa_driver_test_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
|
||||
{
|
||||
struct wpa_hw_modes *modes;
|
||||
struct hostapd_hw_modes *modes;
|
||||
|
||||
*num_modes = 1;
|
||||
*flags = 0;
|
||||
modes = os_zalloc(*num_modes * sizeof(struct wpa_hw_modes));
|
||||
modes = os_zalloc(*num_modes * sizeof(struct hostapd_hw_modes));
|
||||
if (modes == NULL)
|
||||
return NULL;
|
||||
modes[0].mode = WPA_MODE_IEEE80211G;
|
||||
modes[0].mode = HOSTAPD_MODE_IEEE80211G;
|
||||
modes[0].num_channels = 1;
|
||||
modes[0].num_rates = 1;
|
||||
modes[0].channels = os_zalloc(sizeof(struct wpa_channel_data));
|
||||
modes[0].rates = os_zalloc(sizeof(struct wpa_rate_data));
|
||||
modes[0].channels = os_zalloc(sizeof(struct hostapd_channel_data));
|
||||
modes[0].rates = os_zalloc(sizeof(struct hostapd_rate_data));
|
||||
if (modes[0].channels == NULL || modes[0].rates == NULL) {
|
||||
wpa_supplicant_sta_free_hw_features(modes, *num_modes);
|
||||
return NULL;
|
||||
}
|
||||
modes[0].channels[0].chan = 1;
|
||||
modes[0].channels[0].freq = 2412;
|
||||
modes[0].channels[0].flag = WPA_CHAN_W_SCAN | WPA_CHAN_W_ACTIVE_SCAN;
|
||||
modes[0].channels[0].flag = 0;
|
||||
modes[0].rates[0].rate = 10;
|
||||
modes[0].rates[0].flags = WPA_RATE_BASIC | WPA_RATE_SUPPORTED |
|
||||
WPA_RATE_CCK | WPA_RATE_MANDATORY;
|
||||
modes[0].rates[0].flags = HOSTAPD_RATE_BASIC | HOSTAPD_RATE_SUPPORTED |
|
||||
HOSTAPD_RATE_CCK | HOSTAPD_RATE_MANDATORY;
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
|
||||
static int wpa_driver_test_set_channel(void *priv, wpa_hw_mode phymode,
|
||||
static int wpa_driver_test_set_channel(void *priv, hostapd_hw_mode phymode,
|
||||
int chan, int freq)
|
||||
{
|
||||
wpa_printf(MSG_DEBUG, "%s: phymode=%d chan=%d freq=%d",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue