DPP2: Get DPP Relay Controller context based on hostapd callback context
Get the DPP Relay Controller context from the list of configured Controllers based on the correct hostapd callback context. This is needed to pick the correct hostapd interface for sending out the response over air, e.g., when the same hostapd process controls a 2.4 GHz only and a 5 GHz only interface. Signed-off-by: Disha Das <dishad@codeaurora.org>
This commit is contained in:
parent
622be1e10b
commit
80d9756956
3 changed files with 28 additions and 8 deletions
|
@ -757,7 +757,7 @@ static void hostapd_dpp_rx_auth_req(struct hostapd_data *hapd, const u8 *src,
|
||||||
if (!own_bi) {
|
if (!own_bi) {
|
||||||
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
||||||
src, hdr, buf, len, freq, i_bootstrap,
|
src, hdr, buf, len, freq, i_bootstrap,
|
||||||
r_bootstrap) == 0)
|
r_bootstrap, hapd) == 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_DPP2 */
|
#endif /* CONFIG_DPP2 */
|
||||||
|
@ -1276,7 +1276,7 @@ hostapd_dpp_rx_presence_announcement(struct hostapd_data *hapd, const u8 *src,
|
||||||
if (!peer_bi) {
|
if (!peer_bi) {
|
||||||
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
||||||
src, hdr, buf, len, freq, NULL,
|
src, hdr, buf, len, freq, NULL,
|
||||||
r_bootstrap) == 0)
|
r_bootstrap, hapd) == 0)
|
||||||
return;
|
return;
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"DPP: No matching bootstrapping information found");
|
"DPP: No matching bootstrapping information found");
|
||||||
|
@ -1366,7 +1366,7 @@ hostapd_dpp_rx_reconfig_announcement(struct hostapd_data *hapd, const u8 *src,
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
||||||
src, hdr, buf, len, freq, NULL,
|
src, hdr, buf, len, freq, NULL,
|
||||||
NULL) == 0)
|
NULL, hapd) == 0)
|
||||||
return;
|
return;
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"DPP: No matching Configurator information found");
|
"DPP: No matching Configurator information found");
|
||||||
|
@ -1892,7 +1892,8 @@ void hostapd_dpp_rx_action(struct hostapd_data *hapd, const u8 *src,
|
||||||
|
|
||||||
#ifdef CONFIG_DPP2
|
#ifdef CONFIG_DPP2
|
||||||
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
if (dpp_relay_rx_action(hapd->iface->interfaces->dpp,
|
||||||
src, hdr, buf, len, freq, NULL, NULL) == 0)
|
src, hdr, buf, len, freq, NULL, NULL,
|
||||||
|
hapd) == 0)
|
||||||
return;
|
return;
|
||||||
#endif /* CONFIG_DPP2 */
|
#endif /* CONFIG_DPP2 */
|
||||||
|
|
||||||
|
|
|
@ -669,7 +669,8 @@ int dpp_relay_add_controller(struct dpp_global *dpp,
|
||||||
struct dpp_relay_config *config);
|
struct dpp_relay_config *config);
|
||||||
int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr,
|
int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr,
|
||||||
const u8 *buf, size_t len, unsigned int freq,
|
const u8 *buf, size_t len, unsigned int freq,
|
||||||
const u8 *i_bootstrap, const u8 *r_bootstrap);
|
const u8 *i_bootstrap, const u8 *r_bootstrap,
|
||||||
|
void *cb_ctx);
|
||||||
int dpp_relay_rx_gas_req(struct dpp_global *dpp, const u8 *src, const u8 *data,
|
int dpp_relay_rx_gas_req(struct dpp_global *dpp, const u8 *src, const u8 *data,
|
||||||
size_t data_len);
|
size_t data_len);
|
||||||
int dpp_controller_start(struct dpp_global *dpp,
|
int dpp_controller_start(struct dpp_global *dpp,
|
||||||
|
|
|
@ -156,6 +156,24 @@ dpp_relay_controller_get(struct dpp_global *dpp, const u8 *pkhash)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static struct dpp_relay_controller *
|
||||||
|
dpp_relay_controller_get_ctx(struct dpp_global *dpp, void *cb_ctx)
|
||||||
|
{
|
||||||
|
struct dpp_relay_controller *ctrl;
|
||||||
|
|
||||||
|
if (!dpp)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
dl_list_for_each(ctrl, &dpp->controllers, struct dpp_relay_controller,
|
||||||
|
list) {
|
||||||
|
if (cb_ctx == ctrl->cb_ctx)
|
||||||
|
return ctrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dpp_controller_gas_done(struct dpp_connection *conn)
|
static void dpp_controller_gas_done(struct dpp_connection *conn)
|
||||||
{
|
{
|
||||||
struct dpp_authentication *auth = conn->auth;
|
struct dpp_authentication *auth = conn->auth;
|
||||||
|
@ -477,7 +495,8 @@ static int dpp_relay_tx(struct dpp_connection *conn, const u8 *hdr,
|
||||||
|
|
||||||
int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr,
|
int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr,
|
||||||
const u8 *buf, size_t len, unsigned int freq,
|
const u8 *buf, size_t len, unsigned int freq,
|
||||||
const u8 *i_bootstrap, const u8 *r_bootstrap)
|
const u8 *i_bootstrap, const u8 *r_bootstrap,
|
||||||
|
void *cb_ctx)
|
||||||
{
|
{
|
||||||
struct dpp_relay_controller *ctrl;
|
struct dpp_relay_controller *ctrl;
|
||||||
struct dpp_connection *conn;
|
struct dpp_connection *conn;
|
||||||
|
@ -505,8 +524,7 @@ int dpp_relay_rx_action(struct dpp_global *dpp, const u8 *src, const u8 *hdr,
|
||||||
type == DPP_PA_RECONFIG_ANNOUNCEMENT) {
|
type == DPP_PA_RECONFIG_ANNOUNCEMENT) {
|
||||||
/* TODO: Could send this to all configured Controllers. For now,
|
/* TODO: Could send this to all configured Controllers. For now,
|
||||||
* only the first Controller is supported. */
|
* only the first Controller is supported. */
|
||||||
ctrl = dl_list_first(&dpp->controllers,
|
ctrl = dpp_relay_controller_get_ctx(dpp, cb_ctx);
|
||||||
struct dpp_relay_controller, list);
|
|
||||||
} else {
|
} else {
|
||||||
if (!r_bootstrap)
|
if (!r_bootstrap)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue