Use hostapd driver op wrapper for send_mgmt_frame
This commit is contained in:
parent
14f7938660
commit
c90933d2a3
8 changed files with 24 additions and 20 deletions
|
@ -30,7 +30,17 @@ static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg,
|
||||||
|
size_t len)
|
||||||
|
{
|
||||||
|
if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
|
||||||
|
return 0;
|
||||||
|
return hapd->driver->send_mlme(hapd->drv_priv, msg, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
ops->send_mgmt_frame = hostapd_send_mgmt_frame;
|
||||||
}
|
}
|
||||||
|
|
|
@ -315,7 +315,7 @@ void handle_probe_req(struct hostapd_data *hapd,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
if (hostapd_send_mgmt_frame(hapd, resp, pos - (u8 *) resp) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, resp, pos - (u8 *) resp) < 0)
|
||||||
perror("handle_probe_req: send");
|
perror("handle_probe_req: send");
|
||||||
|
|
||||||
os_free(resp);
|
os_free(resp);
|
||||||
|
|
|
@ -184,14 +184,6 @@ hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
|
||||||
buf, len);
|
buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
|
||||||
hostapd_send_mgmt_frame(struct hostapd_data *hapd, const void *msg, size_t len)
|
|
||||||
{
|
|
||||||
if (hapd->driver == NULL || hapd->driver->send_mlme == NULL)
|
|
||||||
return 0;
|
|
||||||
return hapd->driver->send_mlme(hapd->drv_priv, msg, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
|
hostapd_set_countermeasures(struct hostapd_data *hapd, int enabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -710,7 +710,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->bssid, hapd->own_addr, ETH_ALEN);
|
||||||
os_memcpy(&m->u, data, data_len);
|
os_memcpy(&m->u, data, data_len);
|
||||||
|
|
||||||
res = hostapd_send_mgmt_frame(hapd, (u8 *) m, mlen);
|
res = hapd->drv.send_mgmt_frame(hapd, (u8 *) m, mlen);
|
||||||
os_free(m);
|
os_free(m);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ struct hostapd_driver_ops {
|
||||||
int (*set_ap_wps_ie)(struct hostapd_data *hapd,
|
int (*set_ap_wps_ie)(struct hostapd_data *hapd,
|
||||||
const struct wpabuf *beacon,
|
const struct wpabuf *beacon,
|
||||||
const struct wpabuf *probe);
|
const struct wpabuf *probe);
|
||||||
|
int (*send_mgmt_frame)(struct hostapd_data *hapd, const void *msg,
|
||||||
|
size_t len);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -211,7 +211,7 @@ void ieee802_11_send_deauth(struct hostapd_data *hapd, const u8 *addr,
|
||||||
os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
|
os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
|
||||||
os_memcpy(mgmt.bssid, hapd->own_addr, ETH_ALEN);
|
os_memcpy(mgmt.bssid, hapd->own_addr, ETH_ALEN);
|
||||||
mgmt.u.deauth.reason_code = host_to_le16(reason);
|
mgmt.u.deauth.reason_code = host_to_le16(reason);
|
||||||
if (hostapd_send_mgmt_frame(hapd, &mgmt, IEEE80211_HDRLEN +
|
if (hapd->drv.send_mgmt_frame(hapd, &mgmt, IEEE80211_HDRLEN +
|
||||||
sizeof(mgmt.u.deauth)) < 0)
|
sizeof(mgmt.u.deauth)) < 0)
|
||||||
perror("ieee802_11_send_deauth: send");
|
perror("ieee802_11_send_deauth: send");
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ static void send_auth_reply(struct hostapd_data *hapd,
|
||||||
" auth_alg=%d auth_transaction=%d resp=%d (IE len=%lu)",
|
" auth_alg=%d auth_transaction=%d resp=%d (IE len=%lu)",
|
||||||
MAC2STR(dst), auth_alg, auth_transaction,
|
MAC2STR(dst), auth_alg, auth_transaction,
|
||||||
resp, (unsigned long) ies_len);
|
resp, (unsigned long) ies_len);
|
||||||
if (hostapd_send_mgmt_frame(hapd, reply, rlen) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, reply, rlen) < 0)
|
||||||
perror("send_auth_reply: send");
|
perror("send_auth_reply: send");
|
||||||
|
|
||||||
os_free(buf);
|
os_free(buf);
|
||||||
|
@ -816,7 +816,7 @@ static void send_deauth(struct hostapd_data *hapd, const u8 *addr,
|
||||||
send_len = IEEE80211_HDRLEN + sizeof(reply.u.deauth);
|
send_len = IEEE80211_HDRLEN + sizeof(reply.u.deauth);
|
||||||
reply.u.deauth.reason_code = host_to_le16(reason_code);
|
reply.u.deauth.reason_code = host_to_le16(reason_code);
|
||||||
|
|
||||||
if (hostapd_send_mgmt_frame(hapd, &reply, send_len) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, &reply, send_len) < 0)
|
||||||
wpa_printf(MSG_INFO, "Failed to send deauth: %s",
|
wpa_printf(MSG_INFO, "Failed to send deauth: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -877,7 +877,7 @@ static void send_assoc_resp(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
|
|
||||||
send_len += p - reply->u.assoc_resp.variable;
|
send_len += p - reply->u.assoc_resp.variable;
|
||||||
|
|
||||||
if (hostapd_send_mgmt_frame(hapd, reply, send_len) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, reply, send_len) < 0)
|
||||||
wpa_printf(MSG_INFO, "Failed to send assoc resp: %s",
|
wpa_printf(MSG_INFO, "Failed to send assoc resp: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -1187,7 +1187,7 @@ void ieee802_11_send_sa_query_req(struct hostapd_data *hapd,
|
||||||
os_memcpy(mgmt.u.action.u.sa_query_req.trans_id, trans_id,
|
os_memcpy(mgmt.u.action.u.sa_query_req.trans_id, trans_id,
|
||||||
WLAN_SA_QUERY_TR_ID_LEN);
|
WLAN_SA_QUERY_TR_ID_LEN);
|
||||||
end = mgmt.u.action.u.sa_query_req.trans_id + WLAN_SA_QUERY_TR_ID_LEN;
|
end = mgmt.u.action.u.sa_query_req.trans_id + WLAN_SA_QUERY_TR_ID_LEN;
|
||||||
if (hostapd_send_mgmt_frame(hapd, &mgmt, end - (u8 *) &mgmt) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, &mgmt, end - (u8 *) &mgmt) < 0)
|
||||||
perror("ieee802_11_send_sa_query_req: send");
|
perror("ieee802_11_send_sa_query_req: send");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1337,7 +1337,7 @@ static void handle_action(struct hostapd_data *hapd,
|
||||||
os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
|
os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
|
||||||
resp->u.action.category |= 0x80;
|
resp->u.action.category |= 0x80;
|
||||||
|
|
||||||
hostapd_send_mgmt_frame(hapd, resp, len);
|
hapd->drv.send_mgmt_frame(hapd, resp, len);
|
||||||
os_free(resp);
|
os_free(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
|
||||||
ETH_ALEN);
|
ETH_ALEN);
|
||||||
os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
|
os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
|
||||||
|
|
||||||
if (hostapd_send_mgmt_frame(hapd, &hdr, sizeof(hdr)) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, &hdr, sizeof(hdr)) < 0)
|
||||||
perror("ap_handle_timer: send");
|
perror("ap_handle_timer: send");
|
||||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||||
} else if (sta->timeout_next != STA_REMOVE) {
|
} else if (sta->timeout_next != STA_REMOVE) {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "ieee802_11.h"
|
#include "ieee802_11.h"
|
||||||
#include "wme.h"
|
#include "wme.h"
|
||||||
#include "sta_info.h"
|
#include "sta_info.h"
|
||||||
#include "driver_i.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|
||||||
/* TODO: maintain separate sequence and fragment numbers for each AC
|
/* TODO: maintain separate sequence and fragment numbers for each AC
|
||||||
|
@ -144,7 +144,7 @@ static void wmm_send_action(struct hostapd_data *hapd, const u8 *addr,
|
||||||
os_memcpy(t, tspec, sizeof(struct wmm_tspec_element));
|
os_memcpy(t, tspec, sizeof(struct wmm_tspec_element));
|
||||||
len = ((u8 *) (t + 1)) - buf;
|
len = ((u8 *) (t + 1)) - buf;
|
||||||
|
|
||||||
if (hostapd_send_mgmt_frame(hapd, m, len) < 0)
|
if (hapd->drv.send_mgmt_frame(hapd, m, len) < 0)
|
||||||
perror("wmm_send_action: send");
|
perror("wmm_send_action: send");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue