From patchwork Wed Feb 1 00:16:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantinos Natsakis X-Patchwork-Id: 1735165 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.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=MCcb6Cm/; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=aleph-0.net header.i=@aleph-0.net header.a=rsa-sha256 header.s=fm1 header.b=LU85M0nq; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=KvSsYwl3; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P62b53yp5z23hd for ; Wed, 1 Feb 2023 11:18:55 +1100 (AEDT) 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=HU1YDct8xzHSvjqCiDs58r+A+L8U9jyYL9b70WnwFCI=; b=MCcb6Cm/1qNPhD 4VXZ4mW5i8CBQqC3+UCuawwp80PLZbkneY8ZeFCO+40Mi3VX7RFk7lsHzHN0vN6Cr7fbW23gTGW0i J+uLFfGkC9nxuXS+StpM7EPtaUXk40RYWaQDo7uXAbGQ3CXDAcSCUBs9kkBAmRoJxEcXBkXo2De73 1xoN2cJ+edzk/1a/BJWEzuLX1cKsVPv5DtOmj+9MsNjH+oAT8+8jelnTJ5YD7QtkY31Id5GsyS7/3 XBULKdCGZml2IHFv9Qs0lf5VSnBFEITvpDerxiiqBZlx9890MOLj1tRdniXiRKdOwdOzEwbWDU7/H /qQSunsfUYDgoFzIB9Wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pN0ng-009lNg-Ri; Wed, 01 Feb 2023 00:16:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pN0nb-009lMj-3W for hostap@lists.infradead.org; Wed, 01 Feb 2023 00:16:29 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 55C945C018A; Tue, 31 Jan 2023 19:16:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 31 Jan 2023 19:16:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aleph-0.net; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1675210582; x=1675296982; bh=we 3pI/YuoFIlwdN2iisfFZi600DCJurXPBsD5abHvmw=; b=LU85M0nqDURD07FO/Q /mzELsGAxuD/udBm6UL4kBjTFX2ojvACAb9Vs1eDWaWDOHiDS1hMGYJisn1UZYoU PLQ710ArLfEu6cxKeRvIjaEvmiPYlFp4WxBFJqJa1WlGa4PAvz7B2K0cYk1cdQy/ aT8LFgF4BIgqV5Gx/3atD61HTvJTxGii8pbgqzcLw4GkHzTiObn5fLWPMQhNCkMj d00Pyv9eYebVL0IUZr24jIk507qGmGSZQhbVOkDsUmFATK15EVLI+T+IZBbQjjyo uHZsp0WIRJSfCnB5idZVPfKpVOS0xT283CbpqKPVBocdx1H6MH4EU9eelXZYjwjU oBbQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1675210582; x=1675296982; bh=we3pI/YuoFIlw dN2iisfFZi600DCJurXPBsD5abHvmw=; b=KvSsYwl3hqVw/S5BHJlTVloUh5V6Y l798c9COaJOmswpZ+4ku+hxn42h/elIEmn9a9z0LUHuROzhaXvp3bkc3IICTwTHw h07UemqwQNgVHvErwrsl5Fj+6QPcMike/8S1aBk9Xfkejdk2G5joc/BtZ0sI2OEP A5Yx4BAwq5UrjceBO0EP625e8F4iefAxGRDvQ4rHsLLr3NjeB50PmfR7fmcVcNkI WihWad94py9TEMhciqBvbbOh5dpD4oAvVpXZOJXwfZBjEiGLbIapWTsFVpn9yIlS XF2kKZHMNygWl+8ckbOW4Xofn8vTYd2AJoRfiWc5wUsGxRdLNZF11D85Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudefhedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtke ertdertddtnecuhfhrohhmpefmohhnshhtrghnthhinhhoshcupfgrthhsrghkihhsuceo ihhnfhhrrgguvggrugdrohhrghesrghlvghphhdqtddrnhgvtheqnecuggftrfgrthhtvg hrnhepjeelveehjeeugfekleelieektdethffffffgfeeugeelfffhgfeviedvffektdek necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhnfh hrrgguvggrugdrohhrghesrghlvghphhdqtddrnhgvth X-ME-Proxy: Feedback-ID: ieaf146a8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 31 Jan 2023 19:16:21 -0500 (EST) Received: by saturn.ath.dsn.gr (Postfix, from userid 1000) id 0042D3736FD; Wed, 1 Feb 2023 02:16:19 +0200 (EET) From: Konstantinos Natsakis To: hostap@lists.infradead.org Cc: Konstantinos Natsakis Subject: [PATCH] wpa_supplicant: add option to explicitly set 4addr mode Date: Wed, 1 Feb 2023 02:16:18 +0200 Message-Id: <20230201001618.3109751-1-infradead.org@aleph-0.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20221107222007.tphcp4jgf3azez3d@saturn.ath.dsn.gr> References: <20221107222007.tphcp4jgf3azez3d@saturn.ath.dsn.gr> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230131_161627_851631_4769F221 X-CRM114-Status: GOOD ( 18.74 ) X-Spam-Score: -0.9 (/) 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: Add a new option that puts an interface in 4addr mode, for interfaces meant to be enslaved to a bridge Signed-off-by: Konstantinos Natsakis --- wpa_supplicant/config.c | 1 + wpa_supplicant/config_file.c | 1 + wpa_supplicant/config_ssid.h | 11 +++++++++++ wpa_supplicant/event [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [66.111.4.27 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [66.111.4.27 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 Add a new option that puts an interface in 4addr mode, for interfaces meant to be enslaved to a bridge Signed-off-by: Konstantinos Natsakis --- wpa_supplicant/config.c | 1 + wpa_supplicant/config_file.c | 1 + wpa_supplicant/config_ssid.h | 11 +++++++++++ wpa_supplicant/events.c | 28 +++++++++++++++++++++++----- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 9477ad472..277a89645 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2710,6 +2710,7 @@ static const struct parse_data ssid_fields[] = { { INT_RANGE(transition_disable, 0, 255) }, { INT_RANGE(sae_pk, 0, 2) }, { INT_RANGE(disable_eht, 0, 1)}, + { INT_RANGE(enable_4addr_mode, 0, 1)}, }; #undef OFFSET diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 4d50f44a8..e51fc407b 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -890,6 +890,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) INT(disable_he); #endif /* CONFIG_HE_OVERRIDES */ INT(disable_eht); + INT(enable_4addr_mode); #undef STR #undef INT diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 4d89e04b9..9b8df34f5 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -1240,6 +1240,17 @@ struct wpa_ssid { * to 1 to have it disabled. */ int disable_eht; + + /** + * enable_4addr_mode - Set 4addr mode after association + * 0 = do not attempt to set 4addr mode + * 1 = try to set 4addr mode after association + * + * Linux requires that an interface is set to 4addr mode before it can + * be enslaved to a bridge. Set this to 1 for networks where you intent + * to enslave the interface to a bridge. + */ + int enable_4addr_mode; }; #endif /* CONFIG_SSID_H */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 146191d03..e72f2f026 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2700,6 +2700,25 @@ static void interworking_process_assoc_resp(struct wpa_supplicant *wpa_s, #endif /* CONFIG_INTERWORKING */ +static void wpa_supplicant_set_4addr_mode(struct wpa_supplicant *wpa_s) { + if (wpa_s->enabled_4addr_mode) { + wpa_msg(wpa_s, MSG_DEBUG, "4addr mode already set"); + return; + } + + if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) { + wpa_msg(wpa_s, MSG_ERROR, "Failed to set 4addr mode"); + goto fail; + } + wpa_s->enabled_4addr_mode = 1; + wpa_msg(wpa_s, MSG_INFO, "Successfully set 4addr mode"); + return; + +fail: + wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING); +} + + static void multi_ap_process_assoc_resp(struct wpa_supplicant *wpa_s, const u8 *ies, size_t ies_len) { @@ -2752,11 +2771,7 @@ static void multi_ap_set_4addr_mode(struct wpa_supplicant *wpa_s) goto fail; } - if (wpa_drv_set_4addr_mode(wpa_s, 1) < 0) { - wpa_printf(MSG_ERROR, "Failed to set 4addr mode"); - goto fail; - } - wpa_s->enabled_4addr_mode = 1; + wpa_supplicant_set_4addr_mode(wpa_s); return; fail: @@ -3844,6 +3859,9 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s, #ifdef CONFIG_DPP2 wpa_s->dpp_pfs_fallback = 0; #endif /* CONFIG_DPP2 */ + + if (wpa_s->current_ssid && wpa_s->current_ssid->enable_4addr_mode) + wpa_supplicant_set_4addr_mode(wpa_s); }