WPS NFC: Allow BSSID and channel to be included in handover select
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
50d1f8901c
commit
14d8645f63
4 changed files with 40 additions and 4 deletions
|
@ -1823,7 +1823,8 @@ struct wpabuf * hostapd_wps_nfc_hs_cr(struct hostapd_data *hapd, int ndef)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wps_build_nfc_handover_sel(hapd->wps,
|
ret = wps_build_nfc_handover_sel(hapd->wps,
|
||||||
hapd->conf->wps_nfc_dh_pubkey);
|
hapd->conf->wps_nfc_dh_pubkey,
|
||||||
|
hapd->own_addr, hapd->iface->freq);
|
||||||
|
|
||||||
if (ndef && ret) {
|
if (ndef && ret) {
|
||||||
struct wpabuf *tmp;
|
struct wpabuf *tmp;
|
||||||
|
|
|
@ -866,7 +866,8 @@ struct wpabuf * wps_nfc_token_gen(int ndef, int *id, struct wpabuf **pubkey,
|
||||||
struct wpabuf * wps_build_nfc_handover_req(struct wps_context *ctx,
|
struct wpabuf * wps_build_nfc_handover_req(struct wps_context *ctx,
|
||||||
struct wpabuf *nfc_dh_pubkey);
|
struct wpabuf *nfc_dh_pubkey);
|
||||||
struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
|
struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
|
||||||
struct wpabuf *nfc_dh_pubkey);
|
struct wpabuf *nfc_dh_pubkey,
|
||||||
|
const u8 *bssid, int freq);
|
||||||
|
|
||||||
/* ndef.c */
|
/* ndef.c */
|
||||||
struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf);
|
struct wpabuf * ndef_parse_wifi(const struct wpabuf *buf);
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "common/defs.h"
|
||||||
|
#include "common/ieee802_11_common.h"
|
||||||
#include "crypto/aes_wrap.h"
|
#include "crypto/aes_wrap.h"
|
||||||
#include "crypto/crypto.h"
|
#include "crypto/crypto.h"
|
||||||
#include "crypto/dh_group5.h"
|
#include "crypto/dh_group5.h"
|
||||||
|
@ -739,8 +741,38 @@ static int wps_build_ssid(struct wpabuf *msg, struct wps_context *wps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int wps_build_ap_freq(struct wpabuf *msg, int freq)
|
||||||
|
{
|
||||||
|
enum hostapd_hw_mode mode;
|
||||||
|
u8 channel, rf_band;
|
||||||
|
u16 ap_channel;
|
||||||
|
|
||||||
|
if (freq <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
mode = ieee80211_freq_to_chan(freq, &channel);
|
||||||
|
if (mode == NUM_HOSTAPD_MODES)
|
||||||
|
return 0; /* Unknown channel */
|
||||||
|
|
||||||
|
if (mode == HOSTAPD_MODE_IEEE80211G || mode == HOSTAPD_MODE_IEEE80211B)
|
||||||
|
rf_band = WPS_RF_24GHZ;
|
||||||
|
else if (mode == HOSTAPD_MODE_IEEE80211A)
|
||||||
|
rf_band = WPS_RF_50GHZ;
|
||||||
|
else
|
||||||
|
return 0; /* Unknown band */
|
||||||
|
ap_channel = channel;
|
||||||
|
|
||||||
|
if (wps_build_rf_bands_attr(msg, rf_band) ||
|
||||||
|
wps_build_ap_channel(msg, ap_channel))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
|
struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
|
||||||
struct wpabuf *nfc_dh_pubkey)
|
struct wpabuf *nfc_dh_pubkey,
|
||||||
|
const u8 *bssid, int freq)
|
||||||
{
|
{
|
||||||
struct wpabuf *msg;
|
struct wpabuf *msg;
|
||||||
void *len;
|
void *len;
|
||||||
|
@ -765,6 +797,8 @@ struct wpabuf * wps_build_nfc_handover_sel(struct wps_context *ctx,
|
||||||
if (wps_build_oob_dev_pw(msg, DEV_PW_NFC_CONNECTION_HANDOVER,
|
if (wps_build_oob_dev_pw(msg, DEV_PW_NFC_CONNECTION_HANDOVER,
|
||||||
nfc_dh_pubkey, NULL, 0) ||
|
nfc_dh_pubkey, NULL, 0) ||
|
||||||
wps_build_ssid(msg, ctx) ||
|
wps_build_ssid(msg, ctx) ||
|
||||||
|
wps_build_ap_freq(msg, freq) ||
|
||||||
|
(bssid && wps_build_mac_addr(msg, bssid)) ||
|
||||||
wps_build_wfa_ext(msg, 0, NULL, 0)) {
|
wps_build_wfa_ext(msg, 0, NULL, 0)) {
|
||||||
wpabuf_free(msg);
|
wpabuf_free(msg);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -2092,7 +2092,7 @@ struct wpabuf * wps_er_nfc_handover_sel(struct wps_er *er,
|
||||||
os_memcpy(wps->ssid, ap->ap_settings->ssid, ap->ap_settings->ssid_len);
|
os_memcpy(wps->ssid, ap->ap_settings->ssid, ap->ap_settings->ssid_len);
|
||||||
wps->ssid_len = ap->ap_settings->ssid_len;
|
wps->ssid_len = ap->ap_settings->ssid_len;
|
||||||
|
|
||||||
return wps_build_nfc_handover_sel(wps, pubkey);
|
return wps_build_nfc_handover_sel(wps, pubkey, addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_WPS_NFC */
|
#endif /* CONFIG_WPS_NFC */
|
||||||
|
|
Loading…
Reference in a new issue