wpa_supplicant: "don't care" value for pbss in ssid structure

Add a new value 2 to the pbss parameter of wpa_ssid structure, which
means "don't care". This value is used in infrastructure mode to request
connection to either AP or PCP, whichever is available in the scan
results. The value is also used in regular WPS (not P2P group formation)
to make WPS work with devices running as either AP or PCP.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
This commit is contained in:
Lior David 2016-04-04 19:19:25 +03:00 committed by Jouni Malinen
parent 39881726d5
commit 90f14962ec
7 changed files with 36 additions and 9 deletions

View file

@ -214,6 +214,13 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
if (wpa_supplicant_conf_ap_ht(wpa_s, ssid, conf))
return -1;
if (ssid->pbss > 1) {
wpa_printf(MSG_ERROR, "Invalid pbss value(%d) for AP mode",
ssid->pbss);
return -1;
}
bss->pbss = ssid->pbss;
#ifdef CONFIG_ACS
if (ssid->acs) {
/* Setting channel to 0 in order to enable ACS */
@ -453,8 +460,6 @@ no_wps:
wpabuf_dup(wpa_s->conf->ap_vendor_elements);
}
bss->pbss = ssid->pbss;
return 0;
}

View file

@ -2048,7 +2048,7 @@ static const struct parse_data ssid_fields[] = {
{ INT(update_identifier) },
#endif /* CONFIG_HS20 */
{ INT_RANGE(mac_addr, 0, 2) },
{ INT_RANGE(pbss, 0, 1) },
{ INT_RANGE(pbss, 0, 2) },
};
#undef OFFSET

View file

@ -361,10 +361,14 @@ struct wpa_ssid {
/**
* pbss - Whether to use PBSS. Relevant to DMG networks only.
* 0 = do not use PBSS
* 1 = use PBSS
* 2 = don't care (not allowed in AP mode)
* Used together with mode configuration. When mode is AP, it
* means to start a PCP instead of a regular AP. When mode is INFRA it
* means connect to a PCP instead of AP. P2P_GO and P2P_GROUP_FORMATION
* modes must use PBSS in DMG network.
* means connect to a PCP instead of AP. In this mode you can also
* specify 2 (don't care) meaning connect to either AP or PCP.
* P2P_GO and P2P_GROUP_FORMATION modes must use PBSS in DMG network.
*/
int pbss;

View file

@ -1006,7 +1006,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
continue;
}
if (ssid->pbss != bss_is_pbss(bss)) {
if (ssid->pbss != 2 && ssid->pbss != bss_is_pbss(bss)) {
wpa_dbg(wpa_s, MSG_DEBUG, " skip - PBSS mismatch (ssid %d bss %d)",
ssid->pbss, bss_is_pbss(bss));
continue;

View file

@ -2414,7 +2414,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
} else {
params.ssid = ssid->ssid;
params.ssid_len = ssid->ssid_len;
params.pbss = ssid->pbss;
params.pbss = (ssid->pbss != 2) ? ssid->pbss : 0;
}
if (ssid->mode == WPAS_MODE_IBSS && ssid->bssid_set &&

View file

@ -717,10 +717,14 @@ fast_reauth=1
# the network will be used instead of this configured value.
#
# pbss: Whether to use PBSS. Relevant to IEEE 802.11ad networks only.
# 0 = do not use PBSS
# 1 = use PBSS
# 2 = don't care (not allowed in AP mode)
# Used together with mode configuration. When mode is AP, it means to start a
# PCP instead of a regular AP. When mode is infrastructure it means connect
# to a PCP instead of AP. P2P_GO and P2P_GROUP_FORMATION modes must use PBSS
# in IEEE 802.11ad network.
# to a PCP instead of AP. In this mode you can also specify 2 (don't care)
# which means connect to either PCP or AP.
# P2P_GO and P2P_GROUP_FORMATION modes must use PBSS in IEEE 802.11ad network.
# For more details, see IEEE Std 802.11ad-2012.
#
# scan_freq: List of frequencies to scan

View file

@ -1142,6 +1142,13 @@ int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
return -1;
ssid->temporary = 1;
ssid->p2p_group = p2p_group;
/*
* When starting a regular WPS process (not P2P group formation)
* the registrar/final station can be either AP or PCP
* so use a "don't care" value for the pbss flag.
*/
if (!p2p_group)
ssid->pbss = 2;
#ifdef CONFIG_P2P
if (p2p_group && wpa_s->go_params && wpa_s->go_params->ssid_len) {
ssid->ssid = os_zalloc(wpa_s->go_params->ssid_len + 1);
@ -1197,6 +1204,13 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
}
ssid->temporary = 1;
ssid->p2p_group = p2p_group;
/*
* When starting a regular WPS process (not P2P group formation)
* the registrar/final station can be either AP or PCP
* so use a "don't care" value for the pbss flag.
*/
if (!p2p_group)
ssid->pbss = 2;
if (ssid_val) {
ssid->ssid = os_malloc(ssid_len);
if (ssid->ssid) {