From patchwork Mon Sep 19 15:47:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 671813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sd9Kd3YXGz9sXR for ; Tue, 20 Sep 2016 01:48:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bm0o3-0004Xg-4t; Mon, 19 Sep 2016 15:48:31 +0000 Received: from s3.sipsolutions.net ([5.9.151.49] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bm0nr-0004H7-SZ for hostap@lists.infradead.org; Mon, 19 Sep 2016 15:48:24 +0000 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1bm0nT-0005QR-38; Mon, 19 Sep 2016 17:47:55 +0200 From: Benjamin Berg To: hostap@lists.infradead.org Subject: [PATCH 2/6] FT: Default IDs to BSSID if static roaming key is defined. Date: Mon, 19 Sep 2016 17:47:40 +0200 Message-Id: <20160919154744.26244-3-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160919154744.26244-1-benjamin@sipsolutions.net> References: <20160919154744.26244-1-benjamin@sipsolutions.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160919_084820_252001_6F0D1FC1 X-CRM114-Status: GOOD ( 12.74 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.9.151.49 listed in list.dnswl.org] -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Berg MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Benjamin Berg 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 --- 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 */