WPS: Add support for NFC handover select generation with wpa_supplicant
When wpa_supplicant is controlling an AP mode interface, it can generate the alternative carrier record for NFC connection handover select message similarly to the way this is done in hostapd. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
7bfe27778b
commit
5ab9a6a53e
5 changed files with 34 additions and 9 deletions
|
@ -860,6 +860,18 @@ struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
|
||||||
return hostapd_wps_nfc_config_token(hapd, ndef);
|
return hostapd_wps_nfc_config_token(hapd, ndef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct wpabuf * wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||||
|
int ndef)
|
||||||
|
{
|
||||||
|
struct hostapd_data *hapd;
|
||||||
|
|
||||||
|
if (wpa_s->ap_iface == NULL)
|
||||||
|
return NULL;
|
||||||
|
hapd = wpa_s->ap_iface->bss[0];
|
||||||
|
return hostapd_wps_nfc_hs_cr(hapd, ndef);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,5 +54,7 @@ void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
|
||||||
int offset);
|
int offset);
|
||||||
struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
|
struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
|
||||||
int ndef);
|
int ndef);
|
||||||
|
struct wpabuf * wpas_ap_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||||
|
int ndef);
|
||||||
|
|
||||||
#endif /* AP_H */
|
#endif /* AP_H */
|
||||||
|
|
|
@ -909,12 +909,13 @@ static int wpas_ctrl_nfc_get_handover_req(struct wpa_supplicant *wpa_s,
|
||||||
|
|
||||||
|
|
||||||
static int wpas_ctrl_nfc_get_handover_sel_wps(struct wpa_supplicant *wpa_s,
|
static int wpas_ctrl_nfc_get_handover_sel_wps(struct wpa_supplicant *wpa_s,
|
||||||
char *reply, size_t max_len)
|
char *reply, size_t max_len,
|
||||||
|
int ndef, int cr)
|
||||||
{
|
{
|
||||||
struct wpabuf *buf;
|
struct wpabuf *buf;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
buf = wpas_wps_nfc_handover_sel(wpa_s);
|
buf = wpas_wps_nfc_handover_sel(wpa_s, ndef, cr);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -934,18 +935,24 @@ static int wpas_ctrl_nfc_get_handover_sel(struct wpa_supplicant *wpa_s,
|
||||||
size_t max_len)
|
size_t max_len)
|
||||||
{
|
{
|
||||||
char *pos;
|
char *pos;
|
||||||
|
int ndef;
|
||||||
|
|
||||||
pos = os_strchr(cmd, ' ');
|
pos = os_strchr(cmd, ' ');
|
||||||
if (pos == NULL)
|
if (pos == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
*pos++ = '\0';
|
*pos++ = '\0';
|
||||||
|
|
||||||
if (os_strcmp(cmd, "NDEF") != 0)
|
if (os_strcmp(cmd, "WPS") == 0)
|
||||||
|
ndef = 0;
|
||||||
|
else if (os_strcmp(cmd, "NDEF") == 0)
|
||||||
|
ndef = 1;
|
||||||
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (os_strcmp(pos, "WPS") == 0) {
|
if (os_strcmp(pos, "WPS") == 0 || os_strcmp(pos, "WPS-CR") == 0) {
|
||||||
return wpas_ctrl_nfc_get_handover_sel_wps(wpa_s, reply,
|
return wpas_ctrl_nfc_get_handover_sel_wps(
|
||||||
max_len);
|
wpa_s, reply, max_len, ndef,
|
||||||
|
os_strcmp(pos, "WPS-CR") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -2003,9 +2003,12 @@ struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s, int cr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s)
|
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||||
|
int ndef, int cr)
|
||||||
{
|
{
|
||||||
return NULL;
|
if (!cr)
|
||||||
|
return NULL;
|
||||||
|
return wpas_ap_wps_nfc_handover_sel(wpa_s, ndef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,8 @@ int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *bssid);
|
||||||
int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
|
int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
|
||||||
const struct wpabuf *data);
|
const struct wpabuf *data);
|
||||||
struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s, int cr);
|
struct wpabuf * wpas_wps_nfc_handover_req(struct wpa_supplicant *wpa_s, int cr);
|
||||||
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s);
|
struct wpabuf * wpas_wps_nfc_handover_sel(struct wpa_supplicant *wpa_s,
|
||||||
|
int ndef, int cr);
|
||||||
int wpas_wps_nfc_rx_handover_req(struct wpa_supplicant *wpa_s,
|
int wpas_wps_nfc_rx_handover_req(struct wpa_supplicant *wpa_s,
|
||||||
const struct wpabuf *data);
|
const struct wpabuf *data);
|
||||||
int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
|
int wpas_wps_nfc_rx_handover_sel(struct wpa_supplicant *wpa_s,
|
||||||
|
|
Loading…
Reference in a new issue