P2P2: Add alternative PASN RX handler

This is needed for P2P2 pairing using PASN. The actual processing will
be covered in separate commits.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
This commit is contained in:
Shivani Baranwal 2024-08-05 02:43:59 +05:30 committed by Jouni Malinen
parent 7d13410a82
commit 61960e6c6b
5 changed files with 61 additions and 2 deletions

View file

@ -5944,3 +5944,12 @@ void p2p_process_usd_elems(struct p2p_data *p2p, const u8 *ies, u16 ies_len,
p2p_parse_free(&msg);
}
#ifdef CONFIG_PASN
int p2p_pasn_auth_rx(struct p2p_data *p2p, const struct ieee80211_mgmt *mgmt,
size_t len, int freq)
{
return -1; /* TODO */
}
#endif /* CONFIG_PASN */

View file

@ -2576,5 +2576,7 @@ int p2p_channel_to_freq(int op_class, int channel);
struct wpabuf * p2p_usd_elems(struct p2p_data *p2p);
void p2p_process_usd_elems(struct p2p_data *p2p, const u8 *ies, u16 ies_len,
const u8 *peer_addr, unsigned int freq);
int p2p_pasn_auth_rx(struct p2p_data *p2p, const struct ieee80211_mgmt *mgmt,
size_t len, int freq);
#endif /* P2P_H */

View file

@ -6099,6 +6099,37 @@ static void wpas_link_reconfig(struct wpa_supplicant *wpa_s)
}
#ifdef CONFIG_PASN
static int wpas_pasn_auth(struct wpa_supplicant *wpa_s,
const struct ieee80211_mgmt *mgmt, size_t len,
int freq)
{
#ifdef CONFIG_P2P
struct ieee802_11_elems elems;
if (len < 24) {
wpa_printf(MSG_DEBUG, "nl80211: Too short Management frame");
return -2;
}
if (ieee802_11_parse_elems(mgmt->u.auth.variable,
len - offsetof(struct ieee80211_mgmt,
u.auth.variable),
&elems, 1) == ParseFailed) {
wpa_printf(MSG_DEBUG,
"PASN: Failed parsing Authentication frame");
return -2;
}
if (elems.p2p2_ie && elems.p2p2_ie_len)
return wpas_p2p_pasn_auth_rx(wpa_s, mgmt, len, freq);
#endif /* CONFIG_P2P */
return wpas_pasn_auth_rx(wpa_s, mgmt, len);
}
#endif /* CONFIG_PASN */
void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
union wpa_event_data *data)
{
@ -6605,8 +6636,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
}
#ifdef CONFIG_PASN
if (stype == WLAN_FC_STYPE_AUTH &&
wpas_pasn_auth_rx(wpa_s, mgmt,
data->rx_mgmt.frame_len) != -2)
wpas_pasn_auth(wpa_s, mgmt, data->rx_mgmt.frame_len,
data->rx_mgmt.freq) != -2)
break;
#endif /* CONFIG_PASN */

View file

@ -10380,3 +10380,17 @@ void wpas_p2p_process_usd_elems(struct wpa_supplicant *wpa_s, const u8 *buf,
return;
p2p_process_usd_elems(p2p, buf, buf_len, peer_addr, freq);
}
#ifdef CONFIG_PASN
int wpas_p2p_pasn_auth_rx(struct wpa_supplicant *wpa_s,
const struct ieee80211_mgmt *mgmt, size_t len,
int freq)
{
struct p2p_data *p2p = wpa_s->global->p2p;
if (wpa_s->global->p2p_disabled || !p2p)
return -2;
return p2p_pasn_auth_rx(p2p, mgmt, len, freq);
}
#endif /* CONFIG_PASN */

View file

@ -230,6 +230,9 @@ int wpas_p2p_lo_start(struct wpa_supplicant *wpa_s, unsigned int freq,
int wpas_p2p_lo_stop(struct wpa_supplicant *wpa_s);
int wpas_p2p_mac_setup(struct wpa_supplicant *wpa_s);
struct wpabuf * wpas_p2p_usd_elems(struct wpa_supplicant *wpa_s);
int wpas_p2p_pasn_auth_rx(struct wpa_supplicant *wpa_s,
const struct ieee80211_mgmt *mgmt, size_t len,
int freq);
#else /* CONFIG_P2P */