From patchwork Tue Aug 26 07:31:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masashi Honma X-Patchwork-Id: 382998 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]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 68CD314001A for ; Tue, 26 Aug 2014 17:32:05 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 94E3F9D237; Tue, 26 Aug 2014 03:32:02 -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 UtqEhGpQDuKH; Tue, 26 Aug 2014 03:32:02 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 2CF239D202; Tue, 26 Aug 2014 03:31:56 -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 C902D9D202 for ; Tue, 26 Aug 2014 03:31:53 -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 SIzaAFj+wa-f for ; Tue, 26 Aug 2014 03:31:46 -0400 (EDT) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) (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 447799D1F9 for ; Tue, 26 Aug 2014 03:31:46 -0400 (EDT) Received: by mail-pd0-f169.google.com with SMTP id y10so21803341pdj.0 for ; Tue, 26 Aug 2014 00:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sdh/F/GQCwgVPZKIbHeol9KPXwcfMmcamKMZRBqMND4=; b=kDqwUA6/6Jr4UvcfNi4wZJHcHwpmHT6SwEwOf8dmx+rOfiiONr1y3NViUZ5Co+5wat FLEPWKjEvvgd/DYlyYiGgU2u57/6mAy0KL50g2dOckCxCUySYXT/MgfdT9bKiS18KoCI ddVypak87rplVM4j8R86PNniFOIipUxy3XwXTq69AQ/F7noPLslJ/EKJCu33quucoDPG UZKK2nh7xyvZKW96spVOcbkLrSlQOk+oOUdZT55UE9Ne7j/E8rXaRozxJq40+pgcSUZj sRHvZhdeD/X0FdEI9BcD3KJenFhbKhQJIrNyYN+7NwKG/aEX60bHimWBdPqi3xDH6NLT nIpw== X-Received: by 10.68.69.69 with SMTP id c5mr10943983pbu.155.1409038304841; Tue, 26 Aug 2014 00:31:44 -0700 (PDT) Received: from localhost.localdomain (p79020b38.kngwnt01.ap.so-net.ne.jp. [121.2.11.56]) by mx.google.com with ESMTPSA id o2sm3226606pde.30.2014.08.26.00.31.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 00:31:44 -0700 (PDT) From: Masashi Honma To: hostap@lists.shmoo.com Subject: [PATCH] mesh: Make BSSBasicRateSet configurable Date: Tue, 26 Aug 2014 16:31:09 +0900 Message-Id: <1409038270-8295-1-git-send-email-masashi.honma@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <20140826045114.GA23270@localhost> References: <20140826045114.GA23270@localhost> 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 The mesh STAs have different BSSBasicRateSet could not connect to each other because of the specification. [1] 9.6.0c1 Basic Rate Set and Basic MCS Set for mesh STA "A mesh STA shall not establish a mesh peering with a mesh STA using a different BSSBasicRateSet." So I made BSSBasicRateSet configurable. You can configure BSSBasicRateSet by config file like this mesh_basic_rates=10 20 55 or wpa_cli command like this. set_network 0 mesh_basic_rates 10 20 55 [1] IEEE Std 802.11s-2011 Signed-off-by: Masashi Honma --- wpa_supplicant/config.c | 34 ++++++++++++++++++++++++++++++++++ wpa_supplicant/config_file.c | 4 +++- wpa_supplicant/config_ssid.h | 6 ++++++ wpa_supplicant/mesh.c | 36 ++++++++++++++++++++++++++---------- 4 files changed, 69 insertions(+), 11 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index efc0a96..7e8e567 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1579,6 +1579,29 @@ static int wpa_config_parse_mesh_ht_mode(const struct parse_data *data, return 0; } + +static int wpa_config_parse_mesh_basic_rates(const struct parse_data *data, + struct wpa_ssid *ssid, int line, + const char *value) +{ + int *rates = wpa_config_parse_int_array(value); + + if (rates == NULL) { + wpa_printf(MSG_ERROR, "Line %d: Invalid mesh_basic_rates '%s'", + line, value); + return -1; + } + if (rates[0] == 0) { + os_free(rates); + rates = NULL; + } + + os_free(ssid->mesh_basic_rates); + ssid->mesh_basic_rates = rates; + + return 0; +} + #ifndef NO_CONFIG_WRITE static char *wpa_config_write_mesh_ht_mode(const struct parse_data *data, struct wpa_ssid *ssid) @@ -1603,6 +1626,13 @@ static char *wpa_config_write_mesh_ht_mode(const struct parse_data *data, } return val ? os_strdup(val) : NULL; } + + +static char * wpa_config_write_mesh_basic_rates(const struct parse_data *data, + struct wpa_ssid *ssid) +{ + return wpa_config_write_freqs(data, ssid->mesh_basic_rates); +} #endif /* NO_CONFIG_WRITE */ #endif /* CONFIG_MESH */ @@ -1777,6 +1807,7 @@ static const struct parse_data ssid_fields[] = { { INT_RANGE(frequency, 0, 65000) }, #ifdef CONFIG_MESH { FUNC(mesh_ht_mode) }, + { FUNC(mesh_basic_rates) }, #endif { INT(wpa_ptk_rekey) }, { STR(bgscan) }, @@ -2005,6 +2036,9 @@ void wpa_config_free_ssid(struct wpa_ssid *ssid) #ifdef CONFIG_HT_OVERRIDES os_free(ssid->ht_mcs); #endif /* CONFIG_HT_OVERRIDES */ +#ifdef CONFIG_MESH + os_free(ssid->mesh_basic_rates); +#endif /* CONFIG_MESH */ while ((psk = dl_list_first(&ssid->psk_list, struct psk_list_entry, list))) { dl_list_del(&psk->list); diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 4376412..8e2b381 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -742,8 +742,10 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #ifdef CONFIG_HS20 INT(update_identifier); #endif /* CONFIG_HS20 */ - +#ifdef CONFIG_MESH STR(mesh_ht_mode); + STR(mesh_basic_rates); +#endif /* CONFIG_MESH */ #undef STR #undef INT diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 6234f71..aef9128 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -413,6 +413,12 @@ struct wpa_ssid { */ int mesh_ht_mode; + /** + * mesh_basic_rates - BSS Basic rate set for mesh network + * + */ + int *mesh_basic_rates; + int ht40; int vht; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 25b0eb6..0592d51 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -94,6 +94,7 @@ wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, int basic_rates_erp[] = {10, 20, 55, 60, 110, 120, 240, -1 }; static int default_groups[] = { 19, 20, 21, 25, 26 }; size_t len; + int rate_len; if (!wpa_s->conf->user_mpm) { /* not much for us to do here */ @@ -164,18 +165,33 @@ wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, goto out_free; } - /* XXX: hack! this is so an MPM which correctly sets the ERP - * mandatory rates as BSSBasicRateSet doesn't reject us. We - * could add a new hw_mode HOSTAPD_MODE_IEEE80211G_ERP, but - * this is way easier. This also makes our BSSBasicRateSet - * advertised in beacons match the one in peering frames, sigh. - * */ - if (conf->hw_mode == HOSTAPD_MODE_IEEE80211G) { - conf->basic_rates = os_zalloc(sizeof(basic_rates_erp)); - if (!conf->basic_rates) + if (ssid->mesh_basic_rates == NULL) { + /* XXX: hack! this is so an MPM which correctly sets the ERP + * mandatory rates as BSSBasicRateSet doesn't reject us. We + * could add a new hw_mode HOSTAPD_MODE_IEEE80211G_ERP, but + * this is way easier. This also makes our BSSBasicRateSet + * advertised in beacons match the one in peering frames, sigh. + * */ + if (conf->hw_mode == HOSTAPD_MODE_IEEE80211G) { + conf->basic_rates = os_zalloc(sizeof(basic_rates_erp)); + if (!conf->basic_rates) + goto out_free; + os_memcpy(conf->basic_rates, + basic_rates_erp, sizeof(basic_rates_erp)); + } + } else { + rate_len = 0; + while (1) { + if (ssid->mesh_basic_rates[rate_len] < 1) + break; + rate_len++; + } + conf->basic_rates = os_zalloc((rate_len + 1) * sizeof(int)); + if (conf->basic_rates == NULL) goto out_free; os_memcpy(conf->basic_rates, - basic_rates_erp, sizeof(basic_rates_erp)); + ssid->mesh_basic_rates, (rate_len + 1) * sizeof(int)); + conf->basic_rates[rate_len] = -1; } hostapd_setup_interface(ifmsh);