From patchwork Mon Jul 14 05:19:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 369499 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 97D7A1400A8 for ; Mon, 14 Jul 2014 15:40:08 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 84E9A9D257; Mon, 14 Jul 2014 01:40:05 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e7OmskbEPToe; Mon, 14 Jul 2014 01:40:05 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B0C769D347; Mon, 14 Jul 2014 01:39:59 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BD64B9D347 for ; Mon, 14 Jul 2014 01:39:58 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mDfcjH-cAy4F for ; Mon, 14 Jul 2014 01:39:52 -0400 (EDT) Received: from mail-qc0-f180.google.com (mail-qc0-f180.google.com [209.85.216.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 0BFA59D257 for ; Mon, 14 Jul 2014 01:39:51 -0400 (EDT) Received: by mail-qc0-f180.google.com with SMTP id l6so2829482qcy.11 for ; Sun, 13 Jul 2014 22:39:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iKpFWpSwNzO+DJPhIGJjexWbtsCmIAh90DUzRhWmcng=; b=LZaoJyh9jtP1Io7D+twgIHhKZBz4owkK6pkkZGTM96eyFRDALr4mQ4A7tfvRJPNLSJ Urc6SWcIH+86fzwr+toLgYMYoKApLav3SZeduaOZwpLAhGHBKPKCEYFpBMR3NFYCiXSa c0ZaeUD6TraZ1xKL/hVqI7sxdW1HiqG7MDNqwt7pZcwgaIj6BCyeq8Dks2264eg8EkRP L9opT2UCP9b+vuXb6KEhhcag8Q4Ieze3AyQbs+YMdYoToAi90Pko+yFCysJ/ZA39O78+ 8p2V+9A/92nac+b3GTgV4a0S7foBUcHCh5mTKa0YFT851+tusVDEqnsvXiQnbdVYMOeB ilFQ== X-Gm-Message-State: ALoCoQn3BMjUPGAkseYWwfRhpm0ZPVdMxhKcbtk2XbR0+9vpiLCwusyMsqABfIf/2T8igEW6pv6M X-Received: by 10.224.65.134 with SMTP id j6mr18873309qai.90.1405316391643; Sun, 13 Jul 2014 22:39:51 -0700 (PDT) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by mx.google.com with ESMTPSA id p12sm10283472qga.0.2014.07.13.22.39.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 13 Jul 2014 22:39:50 -0700 (PDT) Received: from glass.local ([192.168.1.51] helo=glass.lan) by hash with esmtp (Exim 4.80) (envelope-from ) id 1X6YhG-0005TQ-BU; Mon, 14 Jul 2014 01:21:06 -0400 Received: from bob by glass.lan with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1X6YhH-0002V6-2a; Mon, 14 Jul 2014 01:21:07 -0400 From: Bob Copeland To: hostap@lists.shmoo.com Subject: [PATCH/RFC 13/18] wpa_supplicant: implement mesh scanning Date: Mon, 14 Jul 2014 01:19:18 -0400 Message-Id: <1405315163-9492-14-git-send-email-me@bobcopeland.com> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1405315163-9492-1-git-send-email-me@bobcopeland.com> References: <1405315163-9492-1-git-send-email-me@bobcopeland.com> Cc: devel@lists.open80211s.org, Javier Lopez X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Jason Abele When mesh is configured in, include the wildcard mesh id so that mesh networks are returned. Tag any returned mesh networks with [MESH]. Signed-off-by: Javier Lopez Signed-hostap: Jason Abele --- wpa_supplicant/bss.c | 8 +++++++- wpa_supplicant/ctrl_iface.c | 32 +++++++++++++++++++++++++++++--- wpa_supplicant/mesh.c | 12 ++++++++++++ wpa_supplicant/mesh.h | 2 ++ wpa_supplicant/scan.c | 5 +++++ 5 files changed, 55 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index f99a8a7..b032adb 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -591,7 +591,7 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s, struct wpa_scan_res *res, struct os_reltime *fetch_time) { - const u8 *ssid, *p2p; + const u8 *ssid, *p2p, *mesh; struct wpa_bss *bss; if (wpa_s->conf->ignore_old_scan_res) { @@ -641,7 +641,13 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s, /* TODO: add option for ignoring BSSes we are not interested in * (to save memory) */ + + mesh = wpa_scan_get_ie(res, WLAN_EID_MESH_ID); + if (mesh) + ssid = mesh; + bss = wpa_bss_get(wpa_s, res->bssid, ssid + 2, ssid[1]); + if (bss == NULL) bss = wpa_bss_add(wpa_s, ssid + 2, ssid[1], res, fetch_time); else { diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 9736192..874e0c8 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2113,6 +2113,23 @@ static char * wpa_supplicant_ie_txt(char *pos, char *end, const char *proto, } #endif /* CONFIG_IEEE80211W */ +#ifdef CONFIG_MESH + if (data.key_mgmt & WPA_KEY_MGMT_SAE) { + ret = os_snprintf(pos, end - pos, "%sSAE", + pos == start ? "" : "+"); + if (ret < 0 || ret >= end - pos) + return pos; + pos += ret; + } + if (data.key_mgmt & WPA_KEY_MGMT_FT_SAE) { + ret = os_snprintf(pos, end - pos, "%sFT_SAE", + pos == start ? "" : "+"); + if (ret < 0 || ret >= end - pos) + return pos; + pos += ret; + } +#endif /* CONFIG_MESH */ + pos = wpa_supplicant_cipher_txt(pos, end, data.pairwise_cipher); if (data.capabilities & WPA_CAPABILITY_PREAUTH) { @@ -2180,8 +2197,9 @@ static int wpa_supplicant_ctrl_iface_scan_result( { char *pos, *end; int ret; - const u8 *ie, *ie2, *p2p; + const u8 *ie, *ie2, *p2p, *mesh; + mesh = wpa_bss_get_ie(bss, WLAN_EID_MESH_ID); p2p = wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE); if (!p2p) p2p = wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE); @@ -2202,8 +2220,10 @@ static int wpa_supplicant_ctrl_iface_scan_result( if (ie) pos = wpa_supplicant_ie_txt(pos, end, "WPA", ie, 2 + ie[1]); ie2 = wpa_bss_get_ie(bss, WLAN_EID_RSN); - if (ie2) - pos = wpa_supplicant_ie_txt(pos, end, "WPA2", ie2, 2 + ie2[1]); + if (ie2) { + const char *ie_name = mesh ? "RSN" : "WPA2"; + pos = wpa_supplicant_ie_txt(pos, end, ie_name, ie2, 2 + ie2[1]); + } pos = wpa_supplicant_wps_ie_txt(wpa_s, pos, end, bss); if (!ie && !ie2 && bss->caps & IEEE80211_CAP_PRIVACY) { ret = os_snprintf(pos, end - pos, "[WEP]"); @@ -2211,6 +2231,12 @@ static int wpa_supplicant_ctrl_iface_scan_result( return -1; pos += ret; } + if (mesh) { + ret = os_snprintf(pos, end - pos, "[MESH]"); + if (ret < 0 || ret >= end - pos) + return -1; + pos += ret; + } if (bss_is_dmg(bss)) { const char *s; ret = os_snprintf(pos, end - pos, "[DMG]"); diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 4635b0a..d8b648a 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -227,6 +227,18 @@ void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, const u8 *addr, wpa_mesh_new_mesh_peer(wpa_s, addr, &elems); } +void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s, + struct wpabuf **extra_ie) +{ + /* EID + 0-length (wildcard) mesh-id */ + size_t ielen = 2; + + if (wpabuf_resize(extra_ie, ielen) == 0) { + wpabuf_put_u8(*extra_ie, WLAN_EID_MESH_ID); + wpabuf_put_u8(*extra_ie, 0); + } +} + int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid) { diff --git a/wpa_supplicant/mesh.h b/wpa_supplicant/mesh.h index f08e641..9b14ecf 100644 --- a/wpa_supplicant/mesh.h +++ b/wpa_supplicant/mesh.h @@ -31,6 +31,8 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, int wpa_supplicant_leave_mesh(struct wpa_supplicant *wpa_s); void wpa_mesh_notify_peer(struct wpa_supplicant *wpa_s, const u8 *addr, const u8 *ies, int ie_len); +void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s, + struct wpabuf **extra_ie); void wpa_supplicant_mesh_iface_deinit(struct wpa_supplicant *wpa_s, struct hostapd_iface *ifmsh); #endif /* MESH_H */ diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 40eb8d8..74dd6c2 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -22,6 +22,7 @@ #include "notify.h" #include "bss.h" #include "scan.h" +#include "mesh.h" static void wpa_supplicant_gen_assoc_event(struct wpa_supplicant *wpa_s) @@ -453,6 +454,10 @@ static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s) } #endif /* CONFIG_P2P */ +#ifdef CONFIG_MESH + wpa_supplicant_mesh_add_scan_ie(wpa_s, &extra_ie); +#endif /* CONFIG_MESH */ + #endif /* CONFIG_WPS */ #ifdef CONFIG_HS20