[PATCH 2/6] FT: Default IDs to BSSID if static roaming key is defined.
Benjamin Berg
benjamin at sipsolutions.net
Mon Sep 19 08:47:40 PDT 2016
From: Benjamin Berg <benjamin.berg at open-mesh.com>
The patch "FT: Allow roaming between APs if IDs match MAC" uses the
assumption that both the R0KH-ID (nas_identifier) and R1KH-ID match the
APs MAC address. This assumption allows communication with an AP without
having prior knowledge about its existance.
To facilitate the setup, default both IDs to be set to the APs own
BSSID instead of forcing the user to set all of the options to the same
value.
Signed-off-by: Benjamin Berg <benjamin.berg at open-mesh.com>
---
src/ap/ap_config.c | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 228de2b..db7c87c 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -803,14 +803,29 @@ static int hostapd_config_check_bss(struct hostapd_bss_config *bss,
}
#ifdef CONFIG_IEEE80211R
- if (full_config && wpa_key_mgmt_ft(bss->wpa_key_mgmt) &&
- (bss->nas_identifier == NULL ||
- os_strlen(bss->nas_identifier) < 1 ||
- os_strlen(bss->nas_identifier) > FT_R0KH_ID_MAX_LEN)) {
- wpa_printf(MSG_ERROR, "FT (IEEE 802.11r) requires "
- "nas_identifier to be configured as a 1..48 octet "
- "string");
- return -1;
+ if (full_config && wpa_key_mgmt_ft(bss->wpa_key_mgmt)) {
+
+ /* Default R0KH-ID (nas_identifier) and R1KH-ID to be equal to
+ * the MAC address of the AP interface if bssid is given and
+ * a generic remote access key is set. */
+ if (bss->ft_remote_trust_khid && is_zero_ether_addr(bss->bssid) != 0) {
+ if (os_strlen(bss->nas_identifier) == 0) {
+ snprintf(bss->nas_identifier, FT_R0KH_ID_MAX_LEN, MACSTR, MAC2STR(bss->bssid));
+ bss->nas_identifier[FT_R0KH_ID_MAX_LEN] = '\0';
+ }
+ if (is_zero_ether_addr(bss->r1_key_holder)) {
+ os_memcpy(bss->r1_key_holder, bss->bssid, FT_R1KH_ID_LEN);
+ }
+ }
+
+ if (bss->nas_identifier == NULL ||
+ os_strlen(bss->nas_identifier) < 1 ||
+ os_strlen(bss->nas_identifier) > FT_R0KH_ID_MAX_LEN) {
+ wpa_printf(MSG_ERROR, "FT (IEEE 802.11r) requires "
+ "nas_identifier to be configured as a 1..48 octet "
+ "string");
+ return -1;
+ }
}
#endif /* CONFIG_IEEE80211R */
--
2.9.3
More information about the Hostap
mailing list