From patchwork Mon Aug 6 19:46:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathy Vanhoef X-Patchwork-Id: 954192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cs.kuleuven.be Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rOihERYn"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41kpCd2fnPz9ryt for ; Tue, 7 Aug 2018 05:50:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0V5zeoTv2vp6xkT17uYqqrWQ2eyDtQUxxGkdwZ/Eyu8=; b=rOihERYnzrrzWr3FTbbq7xK6gA WbX4aIjKPU+wE42sZcrMeP2Gzr+egeHIllhKICsWoOHO+L/3qmL546rU8229UiuXNkqwjrKBeYyzD 7Mt33yZu5GouOM53lZsYNJAnQuvIap4LVKKZrWhzh0n/5VVZVuwrnFqK/F3ZZnPUKmZfxKD14RUlR v+16O3qRC1XTuVoYEptTPNonWxRjMi8bXNtrBdhHq1o977+4J0Ov2aj6hGMRFsbM3KPQY4rLy3grc vsnNor+QrhhVs5ghZ7QqZL4pNf8yqsGx30CP2ijOIVJ/MMmu3EupfH6CAvO4EU6b1nzZa8XcttKb9 bkTAyX8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmlWB-0008NO-V4; Mon, 06 Aug 2018 19:50:15 +0000 Received: from vmailrelay1.cs.kuleuven.be ([2a02:2c40:0:a000::118] helo=hermes4.cs.kuleuven.be) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fmlVR-0007Bx-Lo for hostap@lists.infradead.org; Mon, 06 Aug 2018 19:49:31 +0000 Received: from dr-zook.cs.kuleuven.be. (vdr-zook1.cs.kuleuven.be [IPv6:2a02:2c40:500:a005::12c]) by hermes4.cs.kuleuven.be. with ESMTP id w76JiHpj018400 for ; Mon, 6 Aug 2018 21:44:17 +0200 Received: from localhost (localhost [127.0.0.1]) by dr-zook.cs.kuleuven.be. (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w76JiGlF020726 for ; Mon, 6 Aug 2018 21:44:16 +0200 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dr-zook.cs.kuleuven.be. X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Virus-Scanned: Debian amavisd-new at dr-zook.cs.kuleuven.be Received: from dr-zook.cs.kuleuven.be. ([127.0.0.1]) by localhost (dr-zook.cs.kuleuven.be [127.0.0.1]) (amavisd-new, port 10023) with LMTP id bJY3bBkQAuhA for ; Mon, 6 Aug 2018 21:44:08 +0200 (CEST) Received: from oryx.cs.kuleuven.be. (oryx.cs.kuleuven.be [IPv6:2a02:2c40:0:a000::122]) by dr-zook.cs.kuleuven.be. (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w76Ji5SG020707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 6 Aug 2018 21:44:05 +0200 Received: from localhost.localdomain (ip-83-134-207-58.dsl.scarlet.be [83.134.207.58]) (authenticated bits=0) by oryx.cs.kuleuven.be. (A_Good_MTA/8.14.4/Debian-4.1ubuntu1) with ESMTP id w76Jhl8k019837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 6 Aug 2018 21:44:04 +0200 From: Maty Vanhoef To: hostap@lists.infradead.org Subject: [PATCH 03/25] Make channel_info and get_sta available to authenticator Date: Mon, 6 Aug 2018 15:46:21 -0400 Message-Id: <20180806194643.1328-4-Mathy.Vanhoef@cs.kuleuven.be> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180806194643.1328-1-Mathy.Vanhoef@cs.kuleuven.be> References: <20180806194643.1328-1-Mathy.Vanhoef@cs.kuleuven.be> X-Scanned-By: MIMEDefang 2.73 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180806_124930_016271_98C91545 X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maty Vanhoef MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This adds the necessary functions and callbacks to make the channel_info driver API available to the authenticator state machine that implements the 4-way and group key handshake. It also makes the get_sta function available. Signed-off-by: Mathy Vanhoef --- src/ap/ap_drv_ops.h | 8 ++++++++ src/ap/wpa_auth.c | 19 +++++++++++++++++++ src/ap/wpa_auth.h | 3 +++ src/ap/wpa_auth_glue.c | 17 +++++++++++++++++ 4 files changed, 47 insertions(+) diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index db93fde7d..c01d44200 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -356,4 +356,12 @@ static inline int hostapd_drv_stop_ap(struct hostapd_data *hapd) return hapd->driver->stop_ap(hapd->drv_priv); } +static inline int hostapd_drv_channel_info(struct hostapd_data *hapd, + struct wpa_channel_info *ci) +{ + if (hapd->driver == NULL || hapd->driver->channel_info == NULL) + return 0; + return hapd->driver->channel_info(hapd->drv_priv, ci); +} + #endif /* AP_DRV_OPS */ diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c index 126d98c9f..f20dd806a 100644 --- a/src/ap/wpa_auth.c +++ b/src/ap/wpa_auth.c @@ -22,12 +22,14 @@ #include "crypto/sha384.h" #include "crypto/random.h" #include "eapol_auth/eapol_auth_sm.h" +#include "drivers/driver.h" #include "ap_config.h" #include "ieee802_11.h" #include "wpa_auth.h" #include "pmksa_cache_auth.h" #include "wpa_auth_i.h" #include "wpa_auth_ie.h" +#include "sta_info.h" #define STATE_MACHINE_DATA struct wpa_state_machine #define STATE_MACHINE_DEBUG_PREFIX "WPA" @@ -238,6 +240,23 @@ static void wpa_sta_disconnect(struct wpa_authenticator *wpa_auth, } +static int wpa_channel_info(struct wpa_authenticator *wpa_auth, + struct wpa_channel_info *ci) +{ + if (wpa_auth->cb->channel_info == NULL) + return -1; + return wpa_auth->cb->channel_info(wpa_auth->cb_ctx, ci); +} + + +static struct sta_info * wpa_get_sta(struct wpa_authenticator *wpa_auth, + const u8 *addr) +{ + if (wpa_auth->cb->get_sta == NULL) + return NULL; + return wpa_auth->cb->get_sta(wpa_auth->cb_ctx, addr); +} + static void wpa_rekey_gmk(void *eloop_ctx, void *timeout_ctx) { struct wpa_authenticator *wpa_auth = eloop_ctx; diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h index fad5536f7..5837c3e9f 100644 --- a/src/ap/wpa_auth.h +++ b/src/ap/wpa_auth.h @@ -145,6 +145,7 @@ struct wpa_state_machine; struct rsn_pmksa_cache_entry; struct eapol_state_machine; struct ft_remote_seq; +struct wpa_channel_info; struct ft_remote_r0kh { @@ -265,6 +266,8 @@ struct wpa_auth_callbacks { size_t data_len); int (*send_oui)(void *ctx, const u8 *dst, u8 oui_suffix, const u8 *data, size_t data_len); + int (*channel_info)(void *ctx, struct wpa_channel_info *ci); + struct sta_info * (*get_sta)(void *ctx, const u8 *addr); #ifdef CONFIG_IEEE80211R_AP struct wpa_state_machine * (*add_sta)(void *ctx, const u8 *sta_addr); int (*set_vlan)(void *ctx, const u8 *sta_addr, diff --git a/src/ap/wpa_auth_glue.c b/src/ap/wpa_auth_glue.c index 812740301..754b04462 100644 --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c @@ -775,6 +775,21 @@ static int hostapd_wpa_auth_send_oui(void *ctx, const u8 *dst, u8 oui_suffix, #endif /* CONFIG_ETH_P_OUI */ } +int hostapd_channel_info(void *ctx, struct wpa_channel_info *ci) +{ + struct hostapd_data *hapd = ctx; + + if (hostapd_drv_channel_info(hapd, ci) != 0) + return -1; + + return 0; +} + +struct sta_info * hostapd_get_sta(void *ctx, const u8 *addr) +{ + struct hostapd_data *hapd = ctx; + return ap_get_sta(hapd, addr); +} #ifdef CONFIG_IEEE80211R_AP @@ -1202,6 +1217,8 @@ int hostapd_setup_wpa(struct hostapd_data *hapd) .set_session_timeout = hostapd_wpa_auth_set_session_timeout, .get_session_timeout = hostapd_wpa_auth_get_session_timeout, #endif /* CONFIG_IEEE80211R_AP */ + .channel_info = hostapd_channel_info, + .get_sta = hostapd_get_sta }; const u8 *wpa_ie; size_t wpa_ie_len;