mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
DPP: Add process_conf_obj into TCP connection data struct
This is needed to avoid issues with hostapd not having set this function pointer in dpp_global. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
7f366fcbdc
commit
c6a760b9c4
@ -29,6 +29,9 @@ static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd);
|
||||
#ifdef CONFIG_DPP2
|
||||
static void hostapd_dpp_reconfig_reply_wait_timeout(void *eloop_ctx,
|
||||
void *timeout_ctx);
|
||||
static void hostapd_dpp_handle_config_obj(struct hostapd_data *hapd,
|
||||
struct dpp_authentication *auth,
|
||||
struct dpp_config_obj *conf);
|
||||
#endif /* CONFIG_DPP2 */
|
||||
|
||||
static const u8 broadcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
@ -486,6 +489,22 @@ static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd)
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_DPP2
|
||||
static int hostapd_dpp_process_conf_obj(void *ctx,
|
||||
struct dpp_authentication *auth)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < auth->num_conf_obj; i++)
|
||||
hostapd_dpp_handle_config_obj(hapd, auth,
|
||||
&auth->conf_obj[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_DPP2 */
|
||||
|
||||
|
||||
int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd)
|
||||
{
|
||||
const char *pos;
|
||||
@ -602,7 +621,8 @@ int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd)
|
||||
if (tcp)
|
||||
return dpp_tcp_init(hapd->iface->interfaces->dpp, auth,
|
||||
&ipaddr, tcp_port, hapd->conf->dpp_name,
|
||||
DPP_NETROLE_AP, hapd->msg_ctx);
|
||||
DPP_NETROLE_AP, hapd->msg_ctx, hapd,
|
||||
hostapd_dpp_process_conf_obj);
|
||||
#endif /* CONFIG_DPP2 */
|
||||
|
||||
hapd->dpp_auth = auth;
|
||||
|
@ -673,7 +673,11 @@ void dpp_controller_new_qr_code(struct dpp_global *dpp,
|
||||
struct dpp_bootstrap_info *bi);
|
||||
int dpp_tcp_init(struct dpp_global *dpp, struct dpp_authentication *auth,
|
||||
const struct hostapd_ip_addr *addr, int port,
|
||||
const char *name, enum dpp_netrole netrole, void *msg_ctx);
|
||||
const char *name, enum dpp_netrole netrole, void *msg_ctx,
|
||||
void *cb_ctx,
|
||||
int (*process_conf_obj)(void *ctx,
|
||||
struct dpp_authentication *auth));
|
||||
|
||||
struct wpabuf * dpp_build_presence_announcement(struct dpp_bootstrap_info *bi);
|
||||
|
||||
struct dpp_global_config {
|
||||
|
@ -26,6 +26,8 @@ struct dpp_connection {
|
||||
struct dpp_global *global;
|
||||
struct dpp_authentication *auth;
|
||||
void *msg_ctx;
|
||||
void *cb_ctx;
|
||||
int (*process_conf_obj)(void *ctx, struct dpp_authentication *auth);
|
||||
int sock;
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
unsigned int freq;
|
||||
@ -370,6 +372,8 @@ dpp_relay_new_conn(struct dpp_relay_controller *ctrl, const u8 *src,
|
||||
conn->global = ctrl->global;
|
||||
conn->relay = ctrl;
|
||||
conn->msg_ctx = ctrl->global->msg_ctx;
|
||||
conn->cb_ctx = ctrl->global->cb_ctx;
|
||||
conn->process_conf_obj = ctrl->global->process_conf_obj;
|
||||
os_memcpy(conn->mac_addr, src, ETH_ALEN);
|
||||
conn->freq = freq;
|
||||
|
||||
@ -1213,9 +1217,8 @@ static int dpp_tcp_rx_gas_resp(struct dpp_connection *conn, struct wpabuf *resp)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (conn->global->process_conf_obj)
|
||||
res = conn->global->process_conf_obj(conn->global->cb_ctx,
|
||||
auth);
|
||||
if (conn->process_conf_obj)
|
||||
res = conn->process_conf_obj(conn->cb_ctx, auth);
|
||||
else
|
||||
res = 0;
|
||||
|
||||
@ -1498,6 +1501,8 @@ static void dpp_controller_tcp_cb(int sd, void *eloop_ctx, void *sock_ctx)
|
||||
conn->global = ctrl->global;
|
||||
conn->ctrl = ctrl;
|
||||
conn->msg_ctx = ctrl->global->msg_ctx;
|
||||
conn->cb_ctx = ctrl->global->cb_ctx;
|
||||
conn->process_conf_obj = ctrl->global->process_conf_obj;
|
||||
conn->sock = fd;
|
||||
|
||||
if (fcntl(conn->sock, F_SETFL, O_NONBLOCK) != 0) {
|
||||
@ -1524,7 +1529,9 @@ fail:
|
||||
|
||||
int dpp_tcp_init(struct dpp_global *dpp, struct dpp_authentication *auth,
|
||||
const struct hostapd_ip_addr *addr, int port, const char *name,
|
||||
enum dpp_netrole netrole, void *msg_ctx)
|
||||
enum dpp_netrole netrole, void *msg_ctx, void *cb_ctx,
|
||||
int (*process_conf_obj)(void *ctx,
|
||||
struct dpp_authentication *auth))
|
||||
{
|
||||
struct dpp_connection *conn;
|
||||
struct sockaddr_storage saddr;
|
||||
@ -1547,6 +1554,8 @@ int dpp_tcp_init(struct dpp_global *dpp, struct dpp_authentication *auth,
|
||||
}
|
||||
|
||||
conn->msg_ctx = msg_ctx;
|
||||
conn->cb_ctx = cb_ctx;
|
||||
conn->process_conf_obj = process_conf_obj;
|
||||
conn->name = os_strdup(name ? name : "Test");
|
||||
conn->netrole = netrole;
|
||||
conn->global = dpp;
|
||||
|
@ -50,6 +50,8 @@ wpas_dpp_tx_pkex_status(struct wpa_supplicant *wpa_s,
|
||||
static void wpas_dpp_reconfig_reply_wait_timeout(void *eloop_ctx,
|
||||
void *timeout_ctx);
|
||||
static void wpas_dpp_start_gas_client(struct wpa_supplicant *wpa_s);
|
||||
static int wpas_dpp_process_conf_obj(void *ctx,
|
||||
struct dpp_authentication *auth);
|
||||
#endif /* CONFIG_DPP2 */
|
||||
|
||||
static const u8 broadcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
@ -837,7 +839,7 @@ int wpas_dpp_auth_init(struct wpa_supplicant *wpa_s, const char *cmd)
|
||||
if (tcp)
|
||||
return dpp_tcp_init(wpa_s->dpp, auth, &ipaddr, tcp_port,
|
||||
wpa_s->conf->dpp_name, DPP_NETROLE_STA,
|
||||
wpa_s);
|
||||
wpa_s, wpa_s, wpas_dpp_process_conf_obj);
|
||||
#endif /* CONFIG_DPP2 */
|
||||
|
||||
wpa_s->dpp_auth = auth;
|
||||
|
Loading…
Reference in New Issue
Block a user