From patchwork Tue Aug 31 07:44:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jos=C3=A9_Pekkarinen?= X-Patchwork-Id: 1522465 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VLzDgZtx; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=unikie-com.20150623.gappssmtp.com header.i=@unikie-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=sd4yMCNb; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GzK3y0LrJz9sR4 for ; Tue, 31 Aug 2021 17:45:34 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1FX7+Fo5Otvv5GRHHWqu15trHlkXIT5Wdi8u89vVWZU=; b=VLzDgZtxG8vZZX FKi9vS2dKhsmGA8OJSS0N6udrhnf+M3I3ilERieANYfaON9EJ5j7FUdwjF4RONypOmW6BzGIgQkgN gkxoxLyfEWTV154drufHrOgj177j5tM8M/TEhvTUrHs88zAW6I7rAsp1jttsKG+apl4u+xmcEy4xq YpjSR3Hspjarna6bJTgop8vErK6KRuXjWLhbzVmFC1rYfV5arPAwTlo/oKbNkTbRAFrUj5VRjzbzv ctAI3u0c4ZPvTeqSCpEnRRwKC03/vkSuoSyLw1SQ6ZSpfdtRxJXe5h/SwbBL4s21rAh4ikZ5CjyNq p7Y9yKyWH8buoSH1BDfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKyRV-001ivL-9Z; Tue, 31 Aug 2021 07:44:25 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKyRM-001iuD-RE for hostap@lists.infradead.org; Tue, 31 Aug 2021 07:44:18 +0000 Received: by mail-lf1-x12a.google.com with SMTP id p38so36762803lfa.0 for ; Tue, 31 Aug 2021 00:44:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unikie-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e1xa9NQKaGGXmW+eE7Fdy5wW7kvmnVJ4Eg0/Y+yyMZg=; b=sd4yMCNbibHiJwA/+2B5MfR1KjnfYtWXvdy/VQqj+NUMhu1f+8S9MLW9GSh0obnNgH bl3hD/6WHw6U+ZDAg+W93f3cLkK7rq9DcmOkcurKAlHCdIJue3xyKrhnTiBZrwLbbySp zsAgiGsSLP+7Fn7IRoSBEneKyIbbuCr6DENCa6SC7WjI3hk3pmrUamUnllOT5yHlHB26 xtZ639JSJRu0z6P1tACm8aAnyvUu4R82YwPZ10iPOUeuwNF9M5Tb2KcbLhex+R30EfX5 o+vvZATfMn1/haprwtocUlrxykN0b/pvPlxjPTuFbnE4t+/BpDO/tHFGnTSuS0d0Ay+Y TTuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e1xa9NQKaGGXmW+eE7Fdy5wW7kvmnVJ4Eg0/Y+yyMZg=; b=DM+H9M3HVXACMMKyVUzcIGqI0huWfPFsM+fOBQbwDNy24E8NTGuGb2GcHPqo4EsLKb 3dPORqjvYvtmueSeWwJOWV8qgrRSsbfZmZjb31mgqgLmFBpqtIwYCfQkL5W889Rzxx8d +iXnO8O4OGtoLMqyaIPK2v+Sm9FkC74zSxPRuclyBcj1zeA+jpNz/PnFlY5Zv9cQ0ei9 wZzQOZLnVmH1goRIUvmA+yA2Ha9UHzBRkMrxrkhbV547zCQ8+jMOcDAolKE3dkdAN8xZ sLsMLu9S1BRtMofmHE8CyuWnL7Zi/2zIz3LUbxPPO5lYHXPdWPNYh64q37MYROwtlW+h TtvQ== X-Gm-Message-State: AOAM530t3NPQwlboKjbatmMBer86s+RiZ6uUIcGVKCxDrJ+Ld69J0rAj hP3jS66FklpNsYdcdMBglImPOcLsEXvL1h+v X-Google-Smtp-Source: ABdhPJxe263X8kNwjRkakF0gVt/5JIIhEbhFu2mI57hNTpRLQqP8zn0UmgHaXmtDxMHUlYl3pyOPYw== X-Received: by 2002:a19:5e4c:: with SMTP id z12mr20342897lfi.482.1630395855425; Tue, 31 Aug 2021 00:44:15 -0700 (PDT) Received: from Unikie-T14-Gen-2i.madriguera.foxhound.fi (88-113-104-240.elisa-laajakaista.fi. [88.113.104.240]) by smtp.googlemail.com with ESMTPSA id p3sm1649054lfa.228.2021.08.31.00.44.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 00:44:15 -0700 (PDT) From: =?utf-8?q?Jos=C3=A9_Pekkarinen?= To: hostap@lists.infradead.org Cc: Daniel Golle , jose.pekkarinen@unikie.com Subject: [PATCH] mesh: make forwarding configurable Date: Tue, 31 Aug 2021 10:44:07 +0300 Message-Id: <20210831074407.1131280-2-jose.pekkarinen@unikie.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210831074407.1131280-1-jose.pekkarinen@unikie.com> References: <20210831074407.1131280-1-jose.pekkarinen@unikie.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210831_004416_936196_423C48C3 X-CRM114-Status: GOOD ( 23.55 ) X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Daniel Golle Allow mesh_fwding to be specified in a mesh bss config, pass that to the driver (only nl80211 implemented for now) and announce forwarding capability accordingly. Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:12a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Daniel Golle Allow mesh_fwding to be specified in a mesh bss config, pass that to the driver (only nl80211 implemented for now) and announce forwarding capability accordingly. Signed-off-by: José Pekkarinen Signed-off-by: Daniel Golle --- src/ap/ap_config.h | 2 ++ src/drivers/driver.h | 2 ++ src/drivers/driver_nl80211.c | 3 +++ wpa_supplicant/config.c | 4 ++++ wpa_supplicant/config.h | 9 +++++++++ wpa_supplicant/config_file.c | 4 ++++ wpa_supplicant/config_ssid.h | 5 +++++ wpa_supplicant/mesh.c | 6 ++++++ wpa_supplicant/mesh_mpm.c | 4 ++-- wpa_supplicant/wpa_supplicant.conf | 3 +++ 10 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 3ba368987..93938b622 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -51,6 +51,7 @@ struct mesh_conf { int dot11MeshRetryTimeout; /* msec */ int dot11MeshConfirmTimeout; /* msec */ int dot11MeshHoldingTimeout; /* msec */ + int mesh_fwding; }; #define MAX_STA_COUNT 2007 @@ -696,6 +697,7 @@ struct hostapd_bss_config { #define MESH_ENABLED BIT(0) int mesh; + int mesh_fwding; u8 radio_measurements[RRM_CAPABILITIES_IE_LEN]; diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 2020184c5..d3312a34d 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1590,6 +1590,7 @@ struct wpa_driver_mesh_bss_params { #define WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS 0x00000004 #define WPA_DRIVER_MESH_CONF_FLAG_HT_OP_MODE 0x00000008 #define WPA_DRIVER_MESH_CONF_FLAG_RSSI_THRESHOLD 0x00000010 +#define WPA_DRIVER_MESH_CONF_FLAG_FORWARDING 0x00000020 /* * TODO: Other mesh configuration parameters would go here. * See NL80211_MESHCONF_* for all the mesh config parameters. @@ -1599,6 +1600,7 @@ struct wpa_driver_mesh_bss_params { int peer_link_timeout; int max_peer_links; int rssi_threshold; + int forwarding; u16 ht_opmode; }; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index f04934454..e33da2a6f 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -10470,6 +10470,9 @@ static int nl80211_put_mesh_config(struct nl_msg *msg, if (((params->flags & WPA_DRIVER_MESH_CONF_FLAG_AUTO_PLINKS) && nla_put_u8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, params->auto_plinks)) || + ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_FORWARDING) && + nla_put_u8(msg, NL80211_MESHCONF_FORWARDING, + params->forwarding)) || ((params->flags & WPA_DRIVER_MESH_CONF_FLAG_MAX_PEER_LINKS) && nla_put_u16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, params->max_peer_links)) || diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index e8e9fd432..bec114a98 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2527,6 +2527,7 @@ static const struct parse_data ssid_fields[] = { #ifdef CONFIG_MESH { INT_RANGE(mode, 0, 5) }, { INT_RANGE(no_auto_peer, 0, 1) }, + { INT_RANGE(mesh_fwding, 0, 1) }, { INT_RANGE(mesh_rssi_threshold, -255, 1) }, #else /* CONFIG_MESH */ { INT_RANGE(mode, 0, 4) }, @@ -3106,6 +3107,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid) ssid->dot11MeshRetryTimeout = DEFAULT_MESH_RETRY_TIMEOUT; ssid->dot11MeshConfirmTimeout = DEFAULT_MESH_CONFIRM_TIMEOUT; ssid->dot11MeshHoldingTimeout = DEFAULT_MESH_HOLDING_TIMEOUT; + ssid->mesh_fwding = DEFAULT_MESH_FWDING; ssid->mesh_rssi_threshold = DEFAULT_MESH_RSSI_THRESHOLD; #endif /* CONFIG_MESH */ #ifdef CONFIG_HT_OVERRIDES @@ -4347,6 +4349,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface, config->user_mpm = DEFAULT_USER_MPM; config->max_peer_links = DEFAULT_MAX_PEER_LINKS; config->mesh_max_inactivity = DEFAULT_MESH_MAX_INACTIVITY; + config->mesh_fwding = DEFAULT_MESH_FWDING; config->dot11RSNASAERetransPeriod = DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD; config->fast_reauth = DEFAULT_FAST_REAUTH; @@ -5047,6 +5050,7 @@ static const struct global_parse_data global_fields[] = { { INT(user_mpm), 0 }, { INT_RANGE(max_peer_links, 0, 255), 0 }, { INT(mesh_max_inactivity), 0 }, + { INT_RANGE(mesh_fwding, 0, 1), 0 }, { INT(dot11RSNASAERetransPeriod), 0 }, #endif /* CONFIG_MESH */ { INT(disable_scan_offload), 0 }, diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index 68679c6e3..fc3da8c08 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -18,6 +18,7 @@ #define DEFAULT_USER_MPM 1 #define DEFAULT_MAX_PEER_LINKS 99 #define DEFAULT_MESH_MAX_INACTIVITY 300 +#define DEFAULT_MESH_FWDING 1 /* * The default dot11RSNASAERetransPeriod is defined as 40 ms in the standard, * but use 1000 ms in practice to avoid issues on low power CPUs. @@ -1377,6 +1378,14 @@ struct wpa_config { */ int mesh_max_inactivity; + /** + * mesh_fwding - Mesh network layer-2 forwarding + * + * This controls whether to enable layer-2 forwarding. + * By default: 1: enabled + */ + int mesh_fwding; + /** * dot11RSNASAERetransPeriod - Timeout to retransmit SAE Auth frame * diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index a535e3f08..48164fcfb 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -768,6 +768,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) #endif /* IEEE8021X_EAPOL */ INT(mode); INT(no_auto_peer); + INT(mesh_fwding); INT(frequency); INT(enable_edmg); INT(edmg_channel); @@ -1449,6 +1450,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config) fprintf(f, "mesh_max_inactivity=%d\n", config->mesh_max_inactivity); + if (config->mesh_fwding != DEFAULT_MESH_FWDING) + fprintf(f, "mesh_fwding=%d\n", config->mesh_fwding); + if (config->dot11RSNASAERetransPeriod != DEFAULT_DOT11_RSNA_SAE_RETRANS_PERIOD) fprintf(f, "dot11RSNASAERetransPeriod=%d\n", diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 3f7b31480..e5dd3e657 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -546,6 +546,11 @@ struct wpa_ssid { int dot11MeshConfirmTimeout; /* msec */ int dot11MeshHoldingTimeout; /* msec */ + /** + * Mesh network layer-2 forwarding + */ + int mesh_fwding; + int ht; int ht40; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 901b49b4d..35f469f71 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -140,6 +140,7 @@ static struct mesh_conf * mesh_config_create(struct wpa_supplicant *wpa_s, conf->mesh_cc_id = 0; conf->mesh_sp_id = MESH_SYNC_METHOD_NEIGHBOR_OFFSET; conf->mesh_auth_id = (conf->security & MESH_CONF_SEC_AUTH) ? 1 : 0; + conf->mesh_fwding = ssid->mesh_fwding; conf->dot11MeshMaxRetries = ssid->dot11MeshMaxRetries; conf->dot11MeshRetryTimeout = ssid->dot11MeshRetryTimeout; conf->dot11MeshConfirmTimeout = ssid->dot11MeshConfirmTimeout; @@ -441,6 +442,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, bss->conf->start_disabled = 1; bss->conf->mesh = MESH_ENABLED; bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity; + bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding; if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes, wpa_s->hw.num_modes) && wpa_s->conf->country[0]) { @@ -655,6 +657,10 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, } params->conf.peer_link_timeout = wpa_s->conf->mesh_max_inactivity; + /* always explicitely set forwarding to on or off for now */ + params->conf.flags |= WPA_DRIVER_MESH_CONF_FLAG_FORWARDING; + params->conf.forwarding = ssid->mesh_fwding; + os_free(wpa_s->mesh_params); wpa_s->mesh_params = params; if (wpa_supplicant_mesh_init(wpa_s, ssid, ¶ms->freq)) { diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index b6a5e8857..9a7a5d804 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -303,9 +303,9 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, info = (bss->num_plinks > 63 ? 63 : bss->num_plinks) << 1; /* TODO: Add Connected to Mesh Gate/AS subfields */ wpabuf_put_u8(buf, info); - /* always forwarding & accepting plinks for now */ + /* set forwarding & always accepting plinks for now */ wpabuf_put_u8(buf, MESH_CAP_ACCEPT_ADDITIONAL_PEER | - MESH_CAP_FORWARDING); + (conf->mesh_fwding ? MESH_CAP_FORWARDING : 0)); } else { /* Peer closing frame */ /* IE: Mesh ID */ wpabuf_put_u8(buf, WLAN_EID_MESH_ID); diff --git a/wpa_supplicant/wpa_supplicant.conf b/wpa_supplicant/wpa_supplicant.conf index e3ae77114..72a052d82 100644 --- a/wpa_supplicant/wpa_supplicant.conf +++ b/wpa_supplicant/wpa_supplicant.conf @@ -150,6 +150,9 @@ ap_scan=1 # This timeout value is used in mesh STA to clean up inactive stations. #mesh_max_inactivity=300 +# Enable 802.11s layer-2 routing and forwarding +#mesh_fwding=1 + # cert_in_cb - Whether to include a peer certificate dump in events # This controls whether peer certificates for authentication server and # its certificate chain are included in EAP peer certificate events. This is