Make channel_info available to the supplicant state machine

This adds the necessary functions and callbacks to make the channel_info
driver API available to the supplicant state machine that implements the
4-way and group key handshake. This is needed for OCV.

Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
This commit is contained in:
Mathy Vanhoef 2018-08-06 15:46:20 -04:00 committed by Jouni Malinen
parent 7f00dc6e15
commit 4b62b52e5e
3 changed files with 20 additions and 0 deletions

View file

@ -18,6 +18,7 @@ struct wpa_sm;
struct eapol_sm; struct eapol_sm;
struct wpa_config_blob; struct wpa_config_blob;
struct hostapd_freq_params; struct hostapd_freq_params;
struct wpa_channel_info;
struct wpa_sm_ctx { struct wpa_sm_ctx {
void *ctx; /* pointer to arbitrary upper level context */ void *ctx; /* pointer to arbitrary upper level context */
@ -82,6 +83,7 @@ struct wpa_sm_ctx {
int (*key_mgmt_set_pmk)(void *ctx, const u8 *pmk, size_t pmk_len); int (*key_mgmt_set_pmk)(void *ctx, const u8 *pmk, size_t pmk_len);
void (*fils_hlp_rx)(void *ctx, const u8 *dst, const u8 *src, void (*fils_hlp_rx)(void *ctx, const u8 *dst, const u8 *src,
const u8 *pkt, size_t pkt_len); const u8 *pkt, size_t pkt_len);
int (*channel_info)(void *ctx, struct wpa_channel_info *ci);
}; };

View file

@ -395,6 +395,14 @@ static inline void wpa_sm_fils_hlp_rx(struct wpa_sm *sm,
sm->ctx->fils_hlp_rx(sm->ctx->ctx, dst, src, pkt, pkt_len); sm->ctx->fils_hlp_rx(sm->ctx->ctx, dst, src, pkt, pkt_len);
} }
static inline int wpa_sm_channel_info(struct wpa_sm *sm,
struct wpa_channel_info *ci)
{
if (!sm->ctx->channel_info)
return -1;
return sm->ctx->channel_info(sm->ctx->ctx, ci);
}
int wpa_eapol_key_send(struct wpa_sm *sm, struct wpa_ptk *ptk, int wpa_eapol_key_send(struct wpa_sm *sm, struct wpa_ptk *ptk,
int ver, const u8 *dest, u16 proto, int ver, const u8 *dest, u16 proto,

View file

@ -1183,6 +1183,15 @@ static void wpa_supplicant_fils_hlp_rx(void *ctx, const u8 *dst, const u8 *src,
os_free(hex); os_free(hex);
} }
static int wpa_supplicant_channel_info(void *_wpa_s,
struct wpa_channel_info *ci)
{
struct wpa_supplicant *wpa_s = _wpa_s;
return wpa_drv_channel_info(wpa_s, ci);
}
#endif /* CONFIG_NO_WPA */ #endif /* CONFIG_NO_WPA */
@ -1233,6 +1242,7 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s)
ctx->set_rekey_offload = wpa_supplicant_set_rekey_offload; ctx->set_rekey_offload = wpa_supplicant_set_rekey_offload;
ctx->key_mgmt_set_pmk = wpa_supplicant_key_mgmt_set_pmk; ctx->key_mgmt_set_pmk = wpa_supplicant_key_mgmt_set_pmk;
ctx->fils_hlp_rx = wpa_supplicant_fils_hlp_rx; ctx->fils_hlp_rx = wpa_supplicant_fils_hlp_rx;
ctx->channel_info = wpa_supplicant_channel_info;
wpa_s->wpa = wpa_sm_init(ctx); wpa_s->wpa = wpa_sm_init(ctx);
if (wpa_s->wpa == NULL) { if (wpa_s->wpa == NULL) {