From 024d4bca133521aa20b6a43ab08c7778ae2ad0a0 Mon Sep 17 00:00:00 2001 From: Manoj Sekar Date: Mon, 26 Feb 2024 18:29:13 +0530 Subject: [PATCH] Multi-AP: WPS support for different Multi-AP profiles Update EAP-WSC parameters to include Multi-AP profile info to pass the profile information through the provisioning steps. This is needed for provisioning the STA configuration when different profiles are used. Signed-off-by: Manoj Sekar --- src/eap_peer/eap_wsc.c | 14 ++++++++++++-- src/wps/wps.c | 1 + src/wps/wps.h | 5 +++++ src/wps/wps_i.h | 1 + wpa_supplicant/wps_supplicant.c | 11 ++++++++--- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/eap_peer/eap_wsc.c b/src/eap_peer/eap_wsc.c index a1e7bff19..fe61c83e7 100644 --- a/src/eap_peer/eap_wsc.c +++ b/src/eap_peer/eap_wsc.c @@ -255,8 +255,18 @@ static void * eap_wsc_init(struct eap_sm *sm) cfg.new_ap_settings = &new_ap_settings; } - if (os_strstr(phase1, "multi_ap=1")) - cfg.multi_ap_backhaul_sta = 1; + pos = os_strstr(phase1, "multi_ap="); + if (pos) { + u16 id = atoi(pos + 9); + + if (id != 0) { + cfg.multi_ap_backhaul_sta = 1; + cfg.multi_ap_profile = id; + } else { + wpa_printf(MSG_DEBUG, + "EAP-WSC: Invalid multi_ap setting"); + } + } data->wps = wps_init(&cfg); if (data->wps == NULL) { diff --git a/src/wps/wps.c b/src/wps/wps.c index 7cfebfabc..fd5bd931e 100644 --- a/src/wps/wps.c +++ b/src/wps/wps.c @@ -146,6 +146,7 @@ struct wps_data * wps_init(const struct wps_config *cfg) } data->multi_ap_backhaul_sta = cfg->multi_ap_backhaul_sta; + data->multi_ap_profile = cfg->multi_ap_profile; return data; } diff --git a/src/wps/wps.h b/src/wps/wps.h index fed3e2848..b99ae9499 100644 --- a/src/wps/wps.h +++ b/src/wps/wps.h @@ -195,6 +195,11 @@ struct wps_config { * enrollee */ int multi_ap_backhaul_sta; + + /* + * multi_ap_profile - Get the Multi-AP Profile + */ + int multi_ap_profile; }; struct wps_data * wps_init(const struct wps_config *cfg); diff --git a/src/wps/wps_i.h b/src/wps/wps_i.h index 2cf22d4b7..5486e2a1c 100644 --- a/src/wps/wps_i.h +++ b/src/wps/wps_i.h @@ -127,6 +127,7 @@ struct wps_data { struct wps_nfc_pw_token *nfc_pw_token; int multi_ap_backhaul_sta; + int multi_ap_profile; }; diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index 2c08401b3..8cd355f6b 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -1208,14 +1208,19 @@ int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid, } } #endif /* CONFIG_P2P */ - os_snprintf(phase1, sizeof(phase1), "pbc=1%s", - multi_ap_backhaul_sta ? " multi_ap=1" : ""); + if (multi_ap_backhaul_sta) + os_snprintf(phase1, sizeof(phase1), "pbc=1 multi_ap=%d", + multi_ap_backhaul_sta); + else + os_snprintf(phase1, sizeof(phase1), "pbc=1"); if (wpa_config_set_quoted(ssid, "phase1", phase1) < 0) return -1; if (wpa_s->wps_fragment_size) ssid->eap.fragment_size = wpa_s->wps_fragment_size; - if (multi_ap_backhaul_sta) + if (multi_ap_backhaul_sta) { ssid->multi_ap_backhaul_sta = 1; + ssid->multi_ap_profile = multi_ap_backhaul_sta; + } wpa_s->supp_pbc_active = true; wpa_s->wps_overlap = false; wpa_supplicant_wps_event(wpa_s, WPS_EV_PBC_ACTIVE, NULL);