mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2025-01-30 16:54:04 -05:00
Move hostapd-to-driver flag mapping to be within ap_drv_ops.c
This commit is contained in:
parent
d3b86aed73
commit
4c2ddda495
@ -20,6 +20,21 @@
|
|||||||
#include "driver_i.h"
|
#include "driver_i.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_sta_flags_to_drv(int flags)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
if (flags & WLAN_STA_AUTHORIZED)
|
||||||
|
res |= WPA_STA_AUTHORIZED;
|
||||||
|
if (flags & WLAN_STA_WMM)
|
||||||
|
res |= WPA_STA_WMM;
|
||||||
|
if (flags & WLAN_STA_SHORT_PREAMBLE)
|
||||||
|
res |= WPA_STA_SHORT_PREAMBLE;
|
||||||
|
if (flags & WLAN_STA_MFP)
|
||||||
|
res |= WPA_STA_MFP;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd,
|
static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd,
|
||||||
const struct wpabuf *beacon,
|
const struct wpabuf *beacon,
|
||||||
const struct wpabuf *proberesp)
|
const struct wpabuf *proberesp)
|
||||||
@ -98,6 +113,22 @@ static int hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_set_sta_flags(struct hostapd_data *hapd,
|
||||||
|
struct sta_info *sta)
|
||||||
|
{
|
||||||
|
int set_flags, total_flags, flags_and, flags_or;
|
||||||
|
total_flags = hostapd_sta_flags_to_drv(sta->flags);
|
||||||
|
set_flags = WPA_STA_SHORT_PREAMBLE | WPA_STA_WMM | WPA_STA_MFP;
|
||||||
|
if (!hapd->conf->ieee802_1x && !hapd->conf->wpa &&
|
||||||
|
sta->flags & WLAN_STA_AUTHORIZED)
|
||||||
|
set_flags |= WPA_STA_AUTHORIZED;
|
||||||
|
flags_or = total_flags & set_flags;
|
||||||
|
flags_and = total_flags | ~set_flags;
|
||||||
|
return hostapd_sta_set_flags(hapd, sta->addr, total_flags,
|
||||||
|
flags_or, flags_and);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
|
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
|
||||||
{
|
{
|
||||||
ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
|
ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
|
||||||
@ -107,4 +138,5 @@ void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
|
|||||||
ops->set_key = hostapd_set_key;
|
ops->set_key = hostapd_set_key;
|
||||||
ops->read_sta_data = hostapd_read_sta_data;
|
ops->read_sta_data = hostapd_read_sta_data;
|
||||||
ops->sta_clear_stats = hostapd_sta_clear_stats;
|
ops->sta_clear_stats = hostapd_sta_clear_stats;
|
||||||
|
ops->set_sta_flags = hostapd_set_sta_flags;
|
||||||
}
|
}
|
||||||
|
@ -1505,18 +1505,3 @@ int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
|
|||||||
}
|
}
|
||||||
return hostapd_set_ieee8021x(hapd, ¶ms);
|
return hostapd_set_ieee8021x(hapd, ¶ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int hostapd_sta_flags_to_drv(int flags)
|
|
||||||
{
|
|
||||||
int res = 0;
|
|
||||||
if (flags & WLAN_STA_AUTHORIZED)
|
|
||||||
res |= WPA_STA_AUTHORIZED;
|
|
||||||
if (flags & WLAN_STA_WMM)
|
|
||||||
res |= WPA_STA_WMM;
|
|
||||||
if (flags & WLAN_STA_SHORT_PREAMBLE)
|
|
||||||
res |= WPA_STA_SHORT_PREAMBLE;
|
|
||||||
if (flags & WLAN_STA_MFP)
|
|
||||||
res |= WPA_STA_MFP;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
@ -61,6 +61,7 @@ struct hostapd_driver_ops {
|
|||||||
struct hostap_sta_driver_data *data,
|
struct hostap_sta_driver_data *data,
|
||||||
const u8 *addr);
|
const u8 *addr);
|
||||||
int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr);
|
int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr);
|
||||||
|
int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,7 +216,6 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd,
|
|||||||
void *ctx);
|
void *ctx);
|
||||||
int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
|
int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
|
||||||
int enabled);
|
int enabled);
|
||||||
int hostapd_sta_flags_to_drv(int flags);
|
|
||||||
|
|
||||||
int eap_server_register_methods(void);
|
int eap_server_register_methods(void);
|
||||||
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops);
|
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops);
|
||||||
|
@ -1480,7 +1480,6 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
|
|||||||
struct sta_info *sta;
|
struct sta_info *sta;
|
||||||
int new_assoc = 1;
|
int new_assoc = 1;
|
||||||
struct ieee80211_ht_capabilities ht_cap;
|
struct ieee80211_ht_capabilities ht_cap;
|
||||||
int set_flags, total_flags, flags_and, flags_or;
|
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
|
hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211,
|
||||||
@ -1573,15 +1572,7 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
|
|||||||
ap_sta_bind_vlan(hapd, sta, 0);
|
ap_sta_bind_vlan(hapd, sta, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
total_flags = hostapd_sta_flags_to_drv(sta->flags);
|
hapd->drv.set_sta_flags(hapd, sta);
|
||||||
set_flags = WPA_STA_SHORT_PREAMBLE | WPA_STA_WMM | WPA_STA_MFP;
|
|
||||||
if (!hapd->conf->ieee802_1x && !hapd->conf->wpa &&
|
|
||||||
sta->flags & WLAN_STA_AUTHORIZED)
|
|
||||||
set_flags |= WPA_STA_AUTHORIZED;
|
|
||||||
flags_or = total_flags & set_flags;
|
|
||||||
flags_and = total_flags | ~set_flags;
|
|
||||||
hostapd_sta_set_flags(hapd, sta->addr, total_flags,
|
|
||||||
flags_or, flags_and);
|
|
||||||
|
|
||||||
if (sta->auth_alg == WLAN_AUTH_FT)
|
if (sta->auth_alg == WLAN_AUTH_FT)
|
||||||
wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
|
wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC_FT);
|
||||||
|
Loading…
Reference in New Issue
Block a user