Make hostapd_drv_send_mlme() more generic
Merge hostapd_drv_send_mlme_csa() functionality into hostapd_drv_send_mlme() to get a single driver ops handler function for hostapd. In addition, add a new no_encrypt parameter in preparation for functionality that is needed to get rid of the separate send_frame() driver op. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
b3525dc172
commit
3710027463
10 changed files with 26 additions and 33 deletions
|
@ -1662,7 +1662,7 @@ static int hostapd_ctrl_iface_mgmt_tx(struct hostapd_data *hapd, char *cmd)
|
|||
return -1;
|
||||
}
|
||||
|
||||
res = hostapd_drv_send_mlme(hapd, buf, len, 0);
|
||||
res = hostapd_drv_send_mlme(hapd, buf, len, 0, NULL, 0, 0);
|
||||
os_free(buf);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -693,21 +693,12 @@ int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
|
|||
|
||||
|
||||
int hostapd_drv_send_mlme(struct hostapd_data *hapd,
|
||||
const void *msg, size_t len, int noack)
|
||||
const void *msg, size_t len, int noack,
|
||||
const u16 *csa_offs, size_t csa_offs_len,
|
||||
int no_encrypt)
|
||||
{
|
||||
if (!hapd->driver || !hapd->driver->send_mlme || !hapd->drv_priv)
|
||||
return 0;
|
||||
return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
int hostapd_drv_send_mlme_csa(struct hostapd_data *hapd,
|
||||
const void *msg, size_t len, int noack,
|
||||
const u16 *csa_offs, size_t csa_offs_len)
|
||||
{
|
||||
if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
|
||||
return 0;
|
||||
return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
|
||||
csa_offs, csa_offs_len);
|
||||
}
|
||||
|
|
|
@ -93,10 +93,9 @@ int hostapd_drv_set_key(const char *ifname,
|
|||
const u8 *seq, size_t seq_len,
|
||||
const u8 *key, size_t key_len);
|
||||
int hostapd_drv_send_mlme(struct hostapd_data *hapd,
|
||||
const void *msg, size_t len, int noack);
|
||||
int hostapd_drv_send_mlme_csa(struct hostapd_data *hapd,
|
||||
const void *msg, size_t len, int noack,
|
||||
const u16 *csa_offs, size_t csa_offs_len);
|
||||
const void *msg, size_t len, int noack,
|
||||
const u16 *csa_offs, size_t csa_offs_len,
|
||||
int no_encrypt);
|
||||
int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
|
||||
const u8 *addr, int reason);
|
||||
int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
|
||||
|
|
|
@ -1000,9 +1000,9 @@ void handle_probe_req(struct hostapd_data *hapd,
|
|||
hapd->cs_c_off_ecsa_proberesp;
|
||||
}
|
||||
|
||||
ret = hostapd_drv_send_mlme_csa(hapd, resp, resp_len, noack,
|
||||
csa_offs_len ? csa_offs : NULL,
|
||||
csa_offs_len);
|
||||
ret = hostapd_drv_send_mlme(hapd, resp, resp_len, noack,
|
||||
csa_offs_len ? csa_offs : NULL,
|
||||
csa_offs_len, 0);
|
||||
|
||||
if (ret < 0)
|
||||
wpa_printf(MSG_INFO, "handle_probe_req: send failed");
|
||||
|
|
|
@ -495,7 +495,8 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
|
|||
pos += 2;
|
||||
*pos++ = minor_reason_code;
|
||||
|
||||
ret = hostapd_drv_send_mlme(hapd, mgmt, pos - (u8 *) mgmt, 0);
|
||||
ret = hostapd_drv_send_mlme(hapd, mgmt, pos - (u8 *) mgmt, 0, NULL, 0,
|
||||
0);
|
||||
os_free(mgmt);
|
||||
|
||||
return ret < 0 ? -1 : 0;
|
||||
|
|
|
@ -349,7 +349,7 @@ static int send_auth_reply(struct hostapd_data *hapd,
|
|||
" auth_alg=%d auth_transaction=%d resp=%d (IE len=%lu) (dbg=%s)",
|
||||
MAC2STR(dst), auth_alg, auth_transaction,
|
||||
resp, (unsigned long) ies_len, dbg);
|
||||
if (hostapd_drv_send_mlme(hapd, reply, rlen, 0) < 0)
|
||||
if (hostapd_drv_send_mlme(hapd, reply, rlen, 0, NULL, 0, 0) < 0)
|
||||
wpa_printf(MSG_INFO, "send_auth_reply: send failed");
|
||||
else
|
||||
reply_res = WLAN_STATUS_SUCCESS;
|
||||
|
@ -3462,7 +3462,7 @@ static void send_deauth(struct hostapd_data *hapd, const u8 *addr,
|
|||
send_len = IEEE80211_HDRLEN + sizeof(reply.u.deauth);
|
||||
reply.u.deauth.reason_code = host_to_le16(reason_code);
|
||||
|
||||
if (hostapd_drv_send_mlme(hapd, &reply, send_len, 0) < 0)
|
||||
if (hostapd_drv_send_mlme(hapd, &reply, send_len, 0, NULL, 0, 0) < 0)
|
||||
wpa_printf(MSG_INFO, "Failed to send deauth: %s",
|
||||
strerror(errno));
|
||||
}
|
||||
|
@ -3848,7 +3848,7 @@ static u16 send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
}
|
||||
#endif /* CONFIG_FILS */
|
||||
|
||||
if (hostapd_drv_send_mlme(hapd, reply, send_len, 0) < 0) {
|
||||
if (hostapd_drv_send_mlme(hapd, reply, send_len, 0, NULL, 0, 0) < 0) {
|
||||
wpa_printf(MSG_INFO, "Failed to send assoc resp: %s",
|
||||
strerror(errno));
|
||||
res = WLAN_STATUS_UNSPECIFIED_FAILURE;
|
||||
|
@ -4678,7 +4678,7 @@ static int handle_action(struct hostapd_data *hapd,
|
|||
os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
|
||||
resp->u.action.category |= 0x80;
|
||||
|
||||
if (hostapd_drv_send_mlme(hapd, resp, len, 0) < 0) {
|
||||
if (hostapd_drv_send_mlme(hapd, resp, len, 0, NULL, 0, 0) < 0) {
|
||||
wpa_printf(MSG_ERROR, "IEEE 802.11: Failed to send "
|
||||
"Action frame");
|
||||
}
|
||||
|
|
|
@ -112,7 +112,8 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
|
|||
end += oci_ie_len;
|
||||
}
|
||||
#endif /* CONFIG_OCV */
|
||||
if (hostapd_drv_send_mlme(hapd, mgmt, end - (u8 *) mgmt, 0) < 0)
|
||||
if (hostapd_drv_send_mlme(hapd, mgmt, end - (u8 *) mgmt, 0, NULL, 0, 0)
|
||||
< 0)
|
||||
wpa_printf(MSG_INFO, "ieee802_11_send_sa_query_req: send failed");
|
||||
|
||||
os_free(mgmt);
|
||||
|
@ -193,7 +194,8 @@ static void ieee802_11_send_sa_query_resp(struct hostapd_data *hapd,
|
|||
end += oci_ie_len;
|
||||
}
|
||||
#endif /* CONFIG_OCV */
|
||||
if (hostapd_drv_send_mlme(hapd, resp, end - (u8 *) resp, 0) < 0)
|
||||
if (hostapd_drv_send_mlme(hapd, resp, end - (u8 *) resp, 0, NULL, 0, 0)
|
||||
< 0)
|
||||
wpa_printf(MSG_INFO, "ieee80211_mgmt_sa_query_request: send failed");
|
||||
|
||||
os_free(resp);
|
||||
|
|
|
@ -209,7 +209,7 @@ static void wmm_send_action(struct hostapd_data *hapd, const u8 *addr,
|
|||
os_memcpy(t, tspec, sizeof(struct wmm_tspec_element));
|
||||
len = ((u8 *) (t + 1)) - buf;
|
||||
|
||||
if (hostapd_drv_send_mlme(hapd, m, len, 0) < 0)
|
||||
if (hostapd_drv_send_mlme(hapd, m, len, 0, NULL, 0, 0) < 0)
|
||||
wpa_printf(MSG_INFO, "wmm_send_action: send failed");
|
||||
}
|
||||
|
||||
|
|
|
@ -641,7 +641,7 @@ int wnm_send_disassoc_imminent(struct hostapd_data *hapd,
|
|||
|
||||
wpa_printf(MSG_DEBUG, "WNM: Send BSS Transition Management Request frame to indicate imminent disassociation (disassoc_timer=%d) to "
|
||||
MACSTR, disassoc_timer, MAC2STR(sta->addr));
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "Failed to send BSS Transition "
|
||||
"Management Request frame");
|
||||
return -1;
|
||||
|
@ -714,7 +714,7 @@ int wnm_send_ess_disassoc_imminent(struct hostapd_data *hapd,
|
|||
os_memcpy(pos, url, url_len);
|
||||
pos += url_len;
|
||||
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG, "Failed to send BSS Transition "
|
||||
"Management Request frame");
|
||||
return -1;
|
||||
|
@ -790,7 +790,7 @@ int wnm_send_bss_tm_req(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
mbo_len);
|
||||
}
|
||||
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"Failed to send BSS Transition Management Request frame");
|
||||
os_free(buf);
|
||||
|
@ -834,7 +834,7 @@ int wnm_send_coloc_intf_req(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
wpa_printf(MSG_DEBUG, "WNM: Sending Collocated Interference Request to "
|
||||
MACSTR " (dialog_token=%u auto_report=%u timeout=%u)",
|
||||
MAC2STR(sta->addr), dialog_token, auto_report, timeout);
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0) < 0) {
|
||||
if (hostapd_drv_send_mlme(hapd, buf, pos - buf, 0, NULL, 0, 0) < 0) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"WNM: Failed to send Collocated Interference Request frame");
|
||||
return -1;
|
||||
|
|
|
@ -918,7 +918,7 @@ static int hostapd_wpa_auth_send_ft_action(void *ctx, const u8 *dst,
|
|||
os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
|
||||
os_memcpy(&m->u, data, data_len);
|
||||
|
||||
res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen, 0);
|
||||
res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen, 0, NULL, 0, 0);
|
||||
os_free(m);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue