Mark management frame processing functions to use const buffer
This commit is contained in:
parent
ba091c06c5
commit
b57e086cc1
12 changed files with 58 additions and 45 deletions
|
@ -55,7 +55,7 @@ static int ap_list_beacon_olbc(struct hostapd_iface *iface, struct ap_info *ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct ap_info * ap_get_ap(struct hostapd_iface *iface, u8 *ap)
|
struct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *ap)
|
||||||
{
|
{
|
||||||
struct ap_info *s;
|
struct ap_info *s;
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ int ap_ap_for_each(struct hostapd_iface *iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct ap_info * ap_ap_add(struct hostapd_iface *iface, u8 *addr)
|
static struct ap_info * ap_ap_add(struct hostapd_iface *iface, const u8 *addr)
|
||||||
{
|
{
|
||||||
struct ap_info *ap;
|
struct ap_info *ap;
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ static struct ap_info * ap_ap_add(struct hostapd_iface *iface, u8 *addr)
|
||||||
|
|
||||||
|
|
||||||
void ap_list_process_beacon(struct hostapd_iface *iface,
|
void ap_list_process_beacon(struct hostapd_iface *iface,
|
||||||
struct ieee80211_mgmt *mgmt,
|
const struct ieee80211_mgmt *mgmt,
|
||||||
struct ieee802_11_elems *elems,
|
struct ieee802_11_elems *elems,
|
||||||
struct hostapd_frame_info *fi)
|
struct hostapd_frame_info *fi)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,11 +54,11 @@ struct ap_info {
|
||||||
struct ieee802_11_elems;
|
struct ieee802_11_elems;
|
||||||
struct hostapd_frame_info;
|
struct hostapd_frame_info;
|
||||||
|
|
||||||
struct ap_info * ap_get_ap(struct hostapd_iface *iface, u8 *sta);
|
struct ap_info * ap_get_ap(struct hostapd_iface *iface, const u8 *sta);
|
||||||
int ap_ap_for_each(struct hostapd_iface *iface,
|
int ap_ap_for_each(struct hostapd_iface *iface,
|
||||||
int (*func)(struct ap_info *s, void *data), void *data);
|
int (*func)(struct ap_info *s, void *data), void *data);
|
||||||
void ap_list_process_beacon(struct hostapd_iface *iface,
|
void ap_list_process_beacon(struct hostapd_iface *iface,
|
||||||
struct ieee80211_mgmt *mgmt,
|
const struct ieee80211_mgmt *mgmt,
|
||||||
struct ieee802_11_elems *elems,
|
struct ieee802_11_elems *elems,
|
||||||
struct hostapd_frame_info *fi);
|
struct hostapd_frame_info *fi);
|
||||||
#ifdef NEED_AP_MLME
|
#ifdef NEED_AP_MLME
|
||||||
|
|
|
@ -191,13 +191,14 @@ static u8 * hostapd_eid_wpa(struct hostapd_data *hapd, u8 *eid, size_t len,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void handle_probe_req(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
|
void handle_probe_req(struct hostapd_data *hapd,
|
||||||
size_t len)
|
const struct ieee80211_mgmt *mgmt, size_t len)
|
||||||
{
|
{
|
||||||
struct ieee80211_mgmt *resp;
|
struct ieee80211_mgmt *resp;
|
||||||
struct ieee802_11_elems elems;
|
struct ieee802_11_elems elems;
|
||||||
char *ssid;
|
char *ssid;
|
||||||
u8 *pos, *epos, *ie;
|
u8 *pos, *epos;
|
||||||
|
const u8 *ie;
|
||||||
size_t ssid_len, ie_len;
|
size_t ssid_len, ie_len;
|
||||||
struct sta_info *sta = NULL;
|
struct sta_info *sta = NULL;
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
struct ieee80211_mgmt;
|
struct ieee80211_mgmt;
|
||||||
|
|
||||||
void handle_probe_req(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
|
void handle_probe_req(struct hostapd_data *hapd,
|
||||||
size_t len);
|
const struct ieee80211_mgmt *mgmt, size_t len);
|
||||||
#ifdef NEED_AP_MLME
|
#ifdef NEED_AP_MLME
|
||||||
void ieee802_11_set_beacon(struct hostapd_data *hapd);
|
void ieee802_11_set_beacon(struct hostapd_data *hapd);
|
||||||
void ieee802_11_set_beacons(struct hostapd_iface *iface);
|
void ieee802_11_set_beacons(struct hostapd_iface *iface);
|
||||||
|
|
|
@ -351,14 +351,14 @@ static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf,
|
static void hostapd_mgmt_rx(struct hostapd_data *hapd, const u8 *buf,
|
||||||
size_t len, struct hostapd_frame_info *fi)
|
size_t len, struct hostapd_frame_info *fi)
|
||||||
{
|
{
|
||||||
struct hostapd_iface *iface = hapd->iface;
|
struct hostapd_iface *iface = hapd->iface;
|
||||||
struct ieee80211_hdr *hdr;
|
const struct ieee80211_hdr *hdr;
|
||||||
const u8 *bssid;
|
const u8 *bssid;
|
||||||
|
|
||||||
hdr = (struct ieee80211_hdr *) buf;
|
hdr = (const struct ieee80211_hdr *) buf;
|
||||||
bssid = get_hdr_bssid(hdr, len);
|
bssid = get_hdr_bssid(hdr, len);
|
||||||
if (bssid == NULL)
|
if (bssid == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -196,7 +196,8 @@ void ieee802_11_print_ssid(char *buf, const u8 *ssid, u8 len)
|
||||||
* @addr: Address of the destination STA
|
* @addr: Address of the destination STA
|
||||||
* @reason: Reason code for Deauthentication
|
* @reason: Reason code for Deauthentication
|
||||||
*/
|
*/
|
||||||
void ieee802_11_send_deauth(struct hostapd_data *hapd, u8 *addr, u16 reason)
|
void ieee802_11_send_deauth(struct hostapd_data *hapd, const u8 *addr,
|
||||||
|
u16 reason)
|
||||||
{
|
{
|
||||||
struct ieee80211_mgmt mgmt;
|
struct ieee80211_mgmt mgmt;
|
||||||
|
|
||||||
|
@ -217,7 +218,8 @@ void ieee802_11_send_deauth(struct hostapd_data *hapd, u8 *addr, u16 reason)
|
||||||
|
|
||||||
|
|
||||||
static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta,
|
static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
u16 auth_transaction, u8 *challenge, int iswep)
|
u16 auth_transaction, const u8 *challenge,
|
||||||
|
int iswep)
|
||||||
{
|
{
|
||||||
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
||||||
HOSTAPD_LEVEL_DEBUG,
|
HOSTAPD_LEVEL_DEBUG,
|
||||||
|
@ -339,15 +341,15 @@ static void handle_auth_ft_finish(void *ctx, const u8 *dst, const u8 *bssid,
|
||||||
#endif /* CONFIG_IEEE80211R */
|
#endif /* CONFIG_IEEE80211R */
|
||||||
|
|
||||||
|
|
||||||
static void handle_auth(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
|
static void handle_auth(struct hostapd_data *hapd,
|
||||||
size_t len)
|
const struct ieee80211_mgmt *mgmt, size_t len)
|
||||||
{
|
{
|
||||||
u16 auth_alg, auth_transaction, status_code;
|
u16 auth_alg, auth_transaction, status_code;
|
||||||
u16 resp = WLAN_STATUS_SUCCESS;
|
u16 resp = WLAN_STATUS_SUCCESS;
|
||||||
struct sta_info *sta = NULL;
|
struct sta_info *sta = NULL;
|
||||||
int res;
|
int res;
|
||||||
u16 fc;
|
u16 fc;
|
||||||
u8 *challenge = NULL;
|
const u8 *challenge = NULL;
|
||||||
u32 session_timeout, acct_interim_interval;
|
u32 session_timeout, acct_interim_interval;
|
||||||
int vlan_id = 0;
|
int vlan_id = 0;
|
||||||
u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN];
|
u8 resp_ies[2 + WLAN_AUTH_CHALLENGE_LEN];
|
||||||
|
@ -635,7 +637,7 @@ static u16 copy_supp_rates(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
|
|
||||||
|
|
||||||
static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
|
static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
u8 *ies, size_t ies_len, int reassoc)
|
const u8 *ies, size_t ies_len, int reassoc)
|
||||||
{
|
{
|
||||||
struct ieee802_11_elems elems;
|
struct ieee802_11_elems elems;
|
||||||
u16 resp;
|
u16 resp;
|
||||||
|
@ -821,7 +823,7 @@ static void send_deauth(struct hostapd_data *hapd, const u8 *addr,
|
||||||
|
|
||||||
|
|
||||||
static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
|
static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
u16 status_code, int reassoc, u8 *ies,
|
u16 status_code, int reassoc, const u8 *ies,
|
||||||
size_t ies_len)
|
size_t ies_len)
|
||||||
{
|
{
|
||||||
int send_len;
|
int send_len;
|
||||||
|
@ -882,11 +884,12 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
|
|
||||||
|
|
||||||
static void handle_assoc(struct hostapd_data *hapd,
|
static void handle_assoc(struct hostapd_data *hapd,
|
||||||
struct ieee80211_mgmt *mgmt, size_t len, int reassoc)
|
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||||
|
int reassoc)
|
||||||
{
|
{
|
||||||
u16 capab_info, listen_interval;
|
u16 capab_info, listen_interval;
|
||||||
u16 resp = WLAN_STATUS_SUCCESS;
|
u16 resp = WLAN_STATUS_SUCCESS;
|
||||||
u8 *pos;
|
const u8 *pos;
|
||||||
int left, i;
|
int left, i;
|
||||||
struct sta_info *sta;
|
struct sta_info *sta;
|
||||||
|
|
||||||
|
@ -1139,7 +1142,7 @@ static void handle_deauth(struct hostapd_data *hapd,
|
||||||
|
|
||||||
|
|
||||||
static void handle_beacon(struct hostapd_data *hapd,
|
static void handle_beacon(struct hostapd_data *hapd,
|
||||||
struct ieee80211_mgmt *mgmt, size_t len,
|
const struct ieee80211_mgmt *mgmt, size_t len,
|
||||||
struct hostapd_frame_info *fi)
|
struct hostapd_frame_info *fi)
|
||||||
{
|
{
|
||||||
struct ieee802_11_elems elems;
|
struct ieee802_11_elems elems;
|
||||||
|
@ -1190,10 +1193,11 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
|
||||||
|
|
||||||
|
|
||||||
static void hostapd_sa_query_action(struct hostapd_data *hapd,
|
static void hostapd_sa_query_action(struct hostapd_data *hapd,
|
||||||
struct ieee80211_mgmt *mgmt, size_t len)
|
const struct ieee80211_mgmt *mgmt,
|
||||||
|
size_t len)
|
||||||
{
|
{
|
||||||
struct sta_info *sta;
|
struct sta_info *sta;
|
||||||
u8 *end;
|
const u8 *end;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
end = mgmt->u.action.u.sa_query_resp.trans_id +
|
end = mgmt->u.action.u.sa_query_resp.trans_id +
|
||||||
|
@ -1255,7 +1259,7 @@ static int robust_action_frame(u8 category)
|
||||||
|
|
||||||
|
|
||||||
static void handle_action(struct hostapd_data *hapd,
|
static void handle_action(struct hostapd_data *hapd,
|
||||||
struct ieee80211_mgmt *mgmt, size_t len)
|
const struct ieee80211_mgmt *mgmt, size_t len)
|
||||||
{
|
{
|
||||||
struct sta_info *sta;
|
struct sta_info *sta;
|
||||||
|
|
||||||
|
@ -1315,6 +1319,8 @@ static void handle_action(struct hostapd_data *hapd,
|
||||||
mgmt->u.action.category);
|
mgmt->u.action.category);
|
||||||
if (!(mgmt->da[0] & 0x01) && !(mgmt->u.action.category & 0x80) &&
|
if (!(mgmt->da[0] & 0x01) && !(mgmt->u.action.category & 0x80) &&
|
||||||
!(mgmt->sa[0] & 0x01)) {
|
!(mgmt->sa[0] & 0x01)) {
|
||||||
|
struct ieee80211_mgmt *resp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IEEE 802.11-REVma/D9.0 - 7.3.1.11
|
* IEEE 802.11-REVma/D9.0 - 7.3.1.11
|
||||||
* Return the Action frame to the source without change
|
* Return the Action frame to the source without change
|
||||||
|
@ -1322,12 +1328,17 @@ static void handle_action(struct hostapd_data *hapd,
|
||||||
*/
|
*/
|
||||||
wpa_printf(MSG_DEBUG, "IEEE 802.11: Return unknown Action "
|
wpa_printf(MSG_DEBUG, "IEEE 802.11: Return unknown Action "
|
||||||
"frame back to sender");
|
"frame back to sender");
|
||||||
os_memcpy(mgmt->da, mgmt->sa, ETH_ALEN);
|
resp = os_malloc(len);
|
||||||
os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN);
|
if (resp == NULL)
|
||||||
os_memcpy(mgmt->bssid, hapd->own_addr, ETH_ALEN);
|
return;
|
||||||
mgmt->u.action.category |= 0x80;
|
os_memcpy(resp, mgmt, len);
|
||||||
|
os_memcpy(resp->da, resp->sa, ETH_ALEN);
|
||||||
|
os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN);
|
||||||
|
os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
|
||||||
|
resp->u.action.category |= 0x80;
|
||||||
|
|
||||||
hostapd_send_mgmt_frame(hapd, mgmt, len);
|
hostapd_send_mgmt_frame(hapd, resp, len);
|
||||||
|
os_free(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1345,7 +1356,7 @@ static void handle_action(struct hostapd_data *hapd,
|
||||||
* addition, it can be called to re-inserted pending frames (e.g., when using
|
* addition, it can be called to re-inserted pending frames (e.g., when using
|
||||||
* external RADIUS server as an MAC ACL).
|
* external RADIUS server as an MAC ACL).
|
||||||
*/
|
*/
|
||||||
void ieee802_11_mgmt(struct hostapd_data *hapd, u8 *buf, size_t len,
|
void ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
|
||||||
struct hostapd_frame_info *fi)
|
struct hostapd_frame_info *fi)
|
||||||
{
|
{
|
||||||
struct ieee80211_mgmt *mgmt;
|
struct ieee80211_mgmt *mgmt;
|
||||||
|
|
|
@ -23,8 +23,9 @@ struct hostapd_data;
|
||||||
struct sta_info;
|
struct sta_info;
|
||||||
struct hostapd_frame_info;
|
struct hostapd_frame_info;
|
||||||
|
|
||||||
void ieee802_11_send_deauth(struct hostapd_data *hapd, u8 *addr, u16 reason);
|
void ieee802_11_send_deauth(struct hostapd_data *hapd, const u8 *addr,
|
||||||
void ieee802_11_mgmt(struct hostapd_data *hapd, u8 *buf, size_t len,
|
u16 reason);
|
||||||
|
void ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
|
||||||
struct hostapd_frame_info *fi);
|
struct hostapd_frame_info *fi);
|
||||||
void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
|
void ieee802_11_mgmt_cb(struct hostapd_data *hapd, const u8 *buf, size_t len,
|
||||||
u16 stype, int ok);
|
u16 stype, int ok);
|
||||||
|
|
|
@ -223,13 +223,13 @@ int wmm_process_tspec(struct wmm_tspec_element *tspec)
|
||||||
|
|
||||||
|
|
||||||
static void wmm_addts_req(struct hostapd_data *hapd,
|
static void wmm_addts_req(struct hostapd_data *hapd,
|
||||||
struct ieee80211_mgmt *mgmt,
|
const struct ieee80211_mgmt *mgmt,
|
||||||
struct wmm_tspec_element *tspec, size_t len)
|
struct wmm_tspec_element *tspec, size_t len)
|
||||||
{
|
{
|
||||||
u8 *end = ((u8 *) mgmt) + len;
|
const u8 *end = ((const u8 *) mgmt) + len;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if ((u8 *) (tspec + 1) > end) {
|
if ((const u8 *) (tspec + 1) > end) {
|
||||||
wpa_printf(MSG_DEBUG, "WMM: TSPEC overflow in ADDTS Request");
|
wpa_printf(MSG_DEBUG, "WMM: TSPEC overflow in ADDTS Request");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -247,12 +247,12 @@ static void wmm_addts_req(struct hostapd_data *hapd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void hostapd_wmm_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
|
void hostapd_wmm_action(struct hostapd_data *hapd,
|
||||||
size_t len)
|
const struct ieee80211_mgmt *mgmt, size_t len)
|
||||||
{
|
{
|
||||||
int action_code;
|
int action_code;
|
||||||
int left = len - IEEE80211_HDRLEN - 4;
|
int left = len - IEEE80211_HDRLEN - 4;
|
||||||
u8 *pos = ((u8 *) mgmt) + IEEE80211_HDRLEN + 4;
|
const u8 *pos = ((const u8 *) mgmt) + IEEE80211_HDRLEN + 4;
|
||||||
struct ieee802_11_elems elems;
|
struct ieee802_11_elems elems;
|
||||||
struct sta_info *sta = ap_get_sta(hapd, mgmt->sa);
|
struct sta_info *sta = ap_get_sta(hapd, mgmt->sa);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ struct ieee80211_mgmt;
|
||||||
u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
|
u8 * hostapd_eid_wmm(struct hostapd_data *hapd, u8 *eid);
|
||||||
int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid,
|
int hostapd_eid_wmm_valid(struct hostapd_data *hapd, const u8 *eid,
|
||||||
size_t len);
|
size_t len);
|
||||||
void hostapd_wmm_action(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
|
void hostapd_wmm_action(struct hostapd_data *hapd,
|
||||||
size_t len);
|
const struct ieee80211_mgmt *mgmt, size_t len);
|
||||||
int wmm_process_tspec(struct wmm_tspec_element *tspec);
|
int wmm_process_tspec(struct wmm_tspec_element *tspec);
|
||||||
|
|
||||||
#endif /* WME_H */
|
#endif /* WME_H */
|
||||||
|
|
|
@ -1942,7 +1942,7 @@ union wpa_event_data {
|
||||||
* struct rx_mgmt - Data for EVENT_RX_MGMT events
|
* struct rx_mgmt - Data for EVENT_RX_MGMT events
|
||||||
*/
|
*/
|
||||||
struct rx_mgmt {
|
struct rx_mgmt {
|
||||||
u8 *frame;
|
const u8 *frame;
|
||||||
size_t frame_len;
|
size_t frame_len;
|
||||||
struct hostapd_frame_info *fi;
|
struct hostapd_frame_info *fi;
|
||||||
} rx_mgmt;
|
} rx_mgmt;
|
||||||
|
|
|
@ -501,7 +501,7 @@ void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ap_mgmt_rx(void *ctx, u8 *buf, size_t len,
|
void ap_mgmt_rx(void *ctx, const u8 *buf, size_t len,
|
||||||
struct hostapd_frame_info *fi)
|
struct hostapd_frame_info *fi)
|
||||||
{
|
{
|
||||||
#ifdef NEED_AP_MLME
|
#ifdef NEED_AP_MLME
|
||||||
|
|
|
@ -36,7 +36,7 @@ void ap_tx_status(void *ctx, const u8 *addr,
|
||||||
const u8 *buf, size_t len, int ack);
|
const u8 *buf, size_t len, int ack);
|
||||||
void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
|
void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
|
||||||
size_t len);
|
size_t len);
|
||||||
void ap_mgmt_rx(void *ctx, u8 *buf, size_t len,
|
void ap_mgmt_rx(void *ctx, const u8 *buf, size_t len,
|
||||||
struct hostapd_frame_info *fi);
|
struct hostapd_frame_info *fi);
|
||||||
void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok);
|
void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue