From patchwork Wed Oct 23 17:22:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847734 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F20F75809 for ; Wed, 23 Oct 2024 17:23:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704190; cv=none; b=Z0z54Fez4ENgIBd8N1FkRzRWM5bUwlqipeDRY9z4xu0C8rGJ7kRRlzWz6OwJkFX8t3PzX3WOdIxaLmiXQxyV029k5IDOSAdYr3J6T7Lc69axAbgKIlM9U92jcqwhkXJqh8fw/BHft7i+atevSUVoheyEMjrcny6PVLbB+eeUK0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704190; c=relaxed/simple; bh=Et6idfdvQ6toD2ed8vrwN4sya/GuqyrnOmrL2ZaeoL4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gpnRAR3zyIF1+epOF71gO2Flz/fHIVvj3T76uWgEG0XXLdLxGh5LALk1+J3dqoARxm3rWkIz0gnS2iuhvR5UxVzCx1OPExrpmD/KDzzIQI8LcvLanhueScQTX5ufRqg5QtHdHeder8BazYFO51i388sJ1stXTx7ZfY/InMpToQM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZPZo4jh7; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZPZo4jh7" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-7db908c9c83so6506a12.2 for ; Wed, 23 Oct 2024 10:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729704188; x=1730308988; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yyipGZ74nB5NE2vzUBO8Q2hyzO0Dn/o9V44gLe7YzDw=; b=ZPZo4jh7D35CQYQb7TVAQPDVqevjANC/ABKOsX9Tt/t9VTtuXbWMeqHHA+e/5lLRIS UdjYmpHG1Gg07HJa17Xi6VMU5uwqfye1ilZ8zy1t7kVDBu4wBZEj907r740ixoZJLO9q Me42y7KzGAkF0OG8ihGF7w2WZhJ3adHIlGzrwuuBA3PRAo/CzzfFyHcgCgcxMymv55+e Ku68J52Oj3OPam9+6WE9MehzvNAJRDKQSF390cA0tdfzopWr40YhRXhP6hkG3R+d6pLw Hg4uP7e1GUxBmfwTb8g0stQM7mJFjDUOh1GsFcKZ4xDpA7h9mYMcigCzghH7ogsOn8+T dLEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729704188; x=1730308988; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yyipGZ74nB5NE2vzUBO8Q2hyzO0Dn/o9V44gLe7YzDw=; b=soF37oDVZ+SxwWGYM5fn0ij4wP1r1o90gjEVf+DN5BN4fCxFJqd0+AXvwGUaEo19Vk bO+oB3PYLfzyLqoSNRd12uZIQaFZCwLGlZGyoekUrgZUM+qZMySPx43CeLdsL0htnU/8 Sjt0dpg2RPV+EaiQTwzWIVcXqU/Dd8WOCYhpbkE0vxoEen1rMpEsZxvyDlNvAh3HNSN9 iDk5qfNI3BHQBuoE8T9GqOkyu7UCUAbohOZH7cFNWhVhO5TV095wLOAjnwzapnoLLVoq DD5+7oozEXjrvaFAJNca5Cr2eWAhteZ711iXbKRHRKm9ZNpqn/PRXMRBVNXn6U2kO3fa fEqw== X-Gm-Message-State: AOJu0YzZct3ysyD5tER0bShBq5RDkU/sw8mjSIRcDT/efJ6zOvnuZIB6 7LaUCtYTiqj8GQsr7gYaEjjBlATHgp8m7UWh+Bg0q2vWDxs6YRwwZm2prYiD X-Google-Smtp-Source: AGHT+IHH8FgCcutzNLjuGGnakTWFtPx+0QI/w7sFgrZt0tcq4iahaVCnvwOhaZ5wvZy/S6mkW+UtRA== X-Received: by 2002:a05:6a00:b48:b0:71e:1b6d:5a94 with SMTP id d2e1a72fcca58-72030b63117mr4416260b3a.5.1729704188345; Wed, 23 Oct 2024 10:23:08 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1407ed7sm6551923b3a.214.2024.10.23.10.23.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 10:23:07 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/4] wiphy: add OweDisable driver quirk Date: Wed, 23 Oct 2024 10:22:54 -0700 Message-Id: <20241023172257.112771-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some drivers like brcmfmac don't support OWE but from userspace its not possible to query this information. Rather than completely blacklist brcmfmac we can allow the user to configure this and disable OWE in IWD. --- src/wiphy.c | 16 +++++++++++++++- src/wiphy.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/wiphy.c b/src/wiphy.c index cc0e6dd7..d57d657a 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -72,6 +72,7 @@ enum driver_flag { DEFAULT_IF = 0x1, FORCE_PAE = 0x2, POWER_SAVE_DISABLE = 0x4, + OWE_DISABLE = 0x8, }; struct driver_flag_name { @@ -103,6 +104,7 @@ static const struct driver_flag_name driver_flag_names[] = { { "DefaultInterface", DEFAULT_IF }, { "ForcePae", FORCE_PAE }, { "PowerSaveDisable", POWER_SAVE_DISABLE }, + { "OweDisable", OWE_DISABLE }, }; struct wiphy { @@ -344,7 +346,8 @@ wpa2_personal: if (info->akm_suites & IE_RSN_AKM_SUITE_PSK) return IE_RSN_AKM_SUITE_PSK; } else if (security == SECURITY_NONE) { - if (info->akm_suites & IE_RSN_AKM_SUITE_OWE) + if (info->akm_suites & IE_RSN_AKM_SUITE_OWE && + !wiphy_owe_disabled(wiphy)) return IE_RSN_AKM_SUITE_OWE; } @@ -721,6 +724,14 @@ bool wiphy_power_save_disabled(struct wiphy *wiphy) return false; } +bool wiphy_owe_disabled(struct wiphy *wiphy) +{ + if (wiphy->driver_flags & OWE_DISABLE) + return true; + + return false; +} + const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy, uint32_t iftype) { @@ -1355,6 +1366,9 @@ static void wiphy_print_basic_info(struct wiphy *wiphy) if (wiphy->driver_flags & POWER_SAVE_DISABLE) flags = l_strv_append(flags, "PowerSaveDisable"); + if (wiphy->driver_flags & OWE_DISABLE) + flags = l_strv_append(flags, "OweDisable"); + joined = l_strjoinv(flags, ' '); l_info("\tDriver Flags: %s", joined); diff --git a/src/wiphy.h b/src/wiphy.h index fe7e9e49..a68e48c3 100644 --- a/src/wiphy.h +++ b/src/wiphy.h @@ -134,6 +134,7 @@ const char *wiphy_get_name(struct wiphy *wiphy); bool wiphy_uses_default_if(struct wiphy *wiphy); bool wiphy_control_port_enabled(struct wiphy *wiphy); bool wiphy_power_save_disabled(struct wiphy *wiphy); +bool wiphy_owe_disabled(struct wiphy *wiphy); const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy, uint32_t iftype); const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy); From patchwork Wed Oct 23 17:22:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847735 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF7FE6F2F2 for ; Wed, 23 Oct 2024 17:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704192; cv=none; b=t+O8oNkExqYkMlum4183JrPMb9JnitZKqgDP4ETdAbsQbEeT/pQEDF3UbGdn01GWv9sVLTO3qj2jDMR8GS9Mo9mSxFwNuwUqq0lBIyPMpWPBF/wIcsNGn4yZY9eUauflIxvOkjlKUHDftyns/hC1e4lYT1sDiKaGQ89SIEkiuMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704192; c=relaxed/simple; bh=fy9saxEeOdAc2Inw7MDy0DT5tM/z2T3Vhe4JotQlYac=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J160ACYxHqV4AkU+MfoQcC0pWCHE2hHxpPWB+xpVhe/jSX15Emo9QWApFtPSW14KybHnldPT39eqRMMr4tj4Lxzr5RLXdbndNaZWaOw4KeXT74crXjeTpDC7iD/B0IjmE0g/QUL8AGeHv7HHBLp2qsSQR2puD7jW6pfsXMo1Wtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=D2BmmJDL; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D2BmmJDL" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-718e9c8bd83so842909b3a.1 for ; Wed, 23 Oct 2024 10:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729704190; x=1730308990; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3cleyCgLZFebwLrA8Z5Cn7hfeGHhF6AVUO0c6mbLoWI=; b=D2BmmJDL45oeriV/hENlcyIGuXjOd6TRqRdTQOCPwjFMF703HYomdVv8hSYGGYkmPy 8zhrEfUWyIKlavRezSk0AJOmW42trodd+PZi23kTVWKvaBgffs6v6DpAxZJD1nm/IW79 3C48667ui8QhRXdJhpPz3jbE1tBjW3mtvOHXC2Ohf17Bd1TViShq87BMvEl6yMO4wYeV tpi5I6fFzYQGLWCEHleKC13wfS0LtwUSTNXHCDJVIWBtsOBtZ6tZeYLVtfsRELHtaLHv K7yb85ky2KMeRLJ8F2+xWZe6FkY6nMrvQqXh3zSk16v/jN65k6SVaCIzaZBZa3lgQK0L eo4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729704190; x=1730308990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3cleyCgLZFebwLrA8Z5Cn7hfeGHhF6AVUO0c6mbLoWI=; b=cpplHC/b2D7m09+vdxCfCTzJ8v4VN5U3ZgyGPYSRzFzMTELf+/xZCj3RceZRoAUdr6 eDjt4bR9TsUdynNVy0NXWjSA82SFpH8ungACaQ7urwU9ncdoLh08za2b4ELgRrUyQGIq st0TVD8p72gmsIcSDpHHvjbgn45c8j1bAWFvR5vbfJSTNX0hWAH4+YepI+5Wkzxxlzg5 3xkEw9bAklNX95jlrS9OqHiqs60IlrqT7FpR7vPWdvdILQpBhibbabc/YegD97dNdcpX FZRNHJxWjMDFFXwZKSf93tbfQiX1zpKpJCM9LxfHHSI7pXO1BjbbiHUPRGraGOTzge74 wbEA== X-Gm-Message-State: AOJu0YwS0VxDVz4nvMeLUGyDKxWiSI+/x9bYGFRWgHgYosIAUCcR/y7s XJMOz3NWFDAKca7nPwv6bVkMaC8LXZ4uMZ3zxCnCKzEG9qifF0ndYVhF7Olu X-Google-Smtp-Source: AGHT+IGmIO3fFFU0UujOs+igjvRutQFA6Upury9LZTYCcTee70oKABePCLsId01NJbmQe9CbFvfZZA== X-Received: by 2002:a05:6a00:1912:b0:71e:6a57:7288 with SMTP id d2e1a72fcca58-72030f7aed9mr4989394b3a.5.1729704189877; Wed, 23 Oct 2024 10:23:09 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1407ed7sm6551923b3a.214.2024.10.23.10.23.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 10:23:09 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/4] network: don't allow connection to OWE AKM if disabled Date: Wed, 23 Oct 2024 10:22:55 -0700 Message-Id: <20241023172257.112771-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023172257.112771-1-prestwoj@gmail.com> References: <20241023172257.112771-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/network.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/network.c b/src/network.c index 20d9a3dd..5a856fb4 100644 --- a/src/network.c +++ b/src/network.c @@ -911,6 +911,9 @@ int network_can_connect_bss(struct network *network, const struct scan_bss *bss) return ret; } + if (IE_AKM_IS_OWE(rsn.akm_suites) && wiphy_owe_disabled(wiphy)) + return -EPERM; + if (!config || !config->have_transition_disable) { if (band == BAND_FREQ_6_GHZ) goto mfp_no_tkip; From patchwork Wed Oct 23 17:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847736 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79A4D78C9C for ; Wed, 23 Oct 2024 17:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704193; cv=none; b=NzYe19iJs6WgLNj0qsXzkwBfDA8pGUb5wG9yihednzz2dcKrlwVAbgrHtLjrMnI+XqEbdOlSkbuhP8pQZVS0yvbs9SMQNeqsa+EsItDTImEFGWSAFehPu1QXIJKOtf22MWnX6sXhYEhhY7ktkabYvMKj8T4fvh4UeFo02HuP85o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704193; c=relaxed/simple; bh=djLyw7aYUk+qkqAn0atiZBaXa2GRGxYfWD4ZFmvmdsY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gMmERxT8IJzZssa4LQyDMXagexTGq1+6W45gk56InT4t7WlKvl7rZTEjKSMC1B15U7yLQl508jCGGxTRpRN1jLAHVj2mOyB8Wvl+NRks2mWrxMI8GN2WF5bt37LbBpAcvcQsM69r1yeUjqn5Izzpp0YNuT/W9q22XbwTiRSrEYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fn8q2mh5; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fn8q2mh5" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-7ed9f1bcb6bso11107a12.1 for ; Wed, 23 Oct 2024 10:23:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729704191; x=1730308991; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hIn+TlYTrJoVD1XDoEmtFlHWtnNeiCHFqm3HATKm+qM=; b=fn8q2mh5oOXVpUDlPRkV1hwOW3+MapY+GdfmvtfEE9xia/7BNSsNXge/vBIBHsVVR0 D2xs+kjolwBWGD39xmZL+0EPyhRm9aHJ25soHtosauYLighX+z0YGu2ggJArzEMJpROy 3mEE282hNYdQx/7YCfmqfWBrs+eVwU+E6yyh4/MigHD2z0TvhOX0RijEFkfLnQh7AEC7 I7KYqIr81iDkRZIOyLRghVP5deqBWLCLH8aME56WB6uImQOZYq7oaCuiyGp1CIdgbheS 6h69yR+adrDdnVGCa+DkexNDNkFa/z7UY/mNv4XO1tnTq8SNHdVQgps+RDLgMrqIKxKs K8Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729704191; x=1730308991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hIn+TlYTrJoVD1XDoEmtFlHWtnNeiCHFqm3HATKm+qM=; b=rDTfGz91/VQfDLrc6jckntx2g+f4vcjJo4BPFZhV55DRiCpIGp6h5PytPR9kgYvQ5z prn2SCa6k/n0x65ikCzkSwPCVl37T0IowDudnX7nlkt0QHZ1s5KTqUyvoprGFSqpLbor ax3Grznxt/ZwHPYtNLbYFuWqciOubOfc0i4Kqaf2nfj/ZURC0y/IgP/x/jANKfH1nWWd ffKODzvGUkLUnMdBjEvo6CNh0pIaFiVRwcjpa09Mf7Y5pz53Q6NOgpXb6ue6NQdRqYO4 wQTOGeFDwc6379ScX67wi4zBtM4l8ahSm4EK6w+DOJtd6d1G43uP2TPuFcsE+E0lkRq/ KJmQ== X-Gm-Message-State: AOJu0YzpJ+7eM6hjM6rFmPfjXog7S09nVXS/SxgvT/dnKsl4kHqVVQKs sa4xzkevPpKtUFNqvSFwvEnN1gaykOIhJXcWavJ9TVkqzw78t0IQIfrXRhNU X-Google-Smtp-Source: AGHT+IGH0DC/kN6ddr14P0Ofgf5h/wN5HKMxfGoPed/a8UYfT3QKJPCqWACYqpKC8cus4V33BmSAJQ== X-Received: by 2002:a05:6a20:ce44:b0:1d9:3acd:68ea with SMTP id adf61e73a8af0-1d978b2da6dmr4587949637.25.1729704191394; Wed, 23 Oct 2024 10:23:11 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1407ed7sm6551923b3a.214.2024.10.23.10.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 10:23:11 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/4] network: fix OWE transition BSS selection Date: Wed, 23 Oct 2024 10:22:56 -0700 Message-Id: <20241023172257.112771-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023172257.112771-1-prestwoj@gmail.com> References: <20241023172257.112771-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The selection loop was choosing an initial candidate purely for use of the "fallback_to_blacklist" flag. But we have a similar case with OWE transitional networks where we avoid the legacy open network in preference for OWE: /* Don't want to connect to the Open BSS if possible */ if (!bss->rsne) continue; If no OWE network gets selected we may iterate all BSS's and end the loop, which then returns NULL. To fix this move the blacklist check earlier and still ignore any BSS's in the blacklist. Also add a new flag in the selection loop indicating an open network was skipped. If we then exhaust all other BSS's we can return this candidate. --- src/network.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/network.c b/src/network.c index 5a856fb4..dd09a98d 100644 --- a/src/network.c +++ b/src/network.c @@ -1281,6 +1281,7 @@ struct scan_bss *network_bss_select(struct network *network, struct l_queue *bss_list = network->bss_list; const struct l_queue_entry *bss_entry; struct scan_bss *candidate = NULL; + bool skipped_open = false; for (bss_entry = l_queue_get_entries(bss_list); bss_entry; bss_entry = bss_entry->next) { @@ -1300,30 +1301,34 @@ struct scan_bss *network_bss_select(struct network *network, if (!candidate) candidate = bss; + /* check if temporarily blacklisted */ + if (l_queue_find(network->blacklist, match_bss, bss)) + continue; + + if (blacklist_contains_bss(bss->addr)) + continue; + /* OWE Transition BSS */ if (bss->owe_trans) { /* Don't want to connect to the Open BSS if possible */ - if (!bss->rsne) + if (!bss->rsne) { + skipped_open = true; continue; + } /* Candidate is not OWE, set this as new candidate */ if (!(candidate->owe_trans && candidate->rsne)) candidate = bss; } - /* check if temporarily blacklisted */ - if (l_queue_find(network->blacklist, match_bss, bss)) - continue; - - if (!blacklist_contains_bss(bss->addr)) - return bss; + return candidate; } /* * No BSS was found, but if we are falling back to blacklisted BSS's we * can just use the first connectable candidate found above. */ - if (fallback_to_blacklist) + if (fallback_to_blacklist || skipped_open) return candidate; return NULL; From patchwork Wed Oct 23 17:22:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847737 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 071521D043F for ; Wed, 23 Oct 2024 17:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704195; cv=none; b=mVAJlUWkao/yVrprKRPCqmcGNE3edUh0Ur9WUXo2ny+lUDWs42nQNrcS33kLzsKTOQfcLSnHRaEG09FZtPPyggG0o/dDjqwmsLSbSCXvfQFRI6xLPHGvzDzJ09W6O6TiwGQ9lMlIi12kaHEQcs8K4lIqBp2aD/zu2zp+uMZTfkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729704195; c=relaxed/simple; bh=NpeRjzndCNRsacZyfxijkggR7qWgKwLo1+H6PAtbo7Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OrbQOvuJBhaf6/kSxJlFB9d5l+GJfY62nL6P5MNYEyg7do4UwEh+QLk/Tx8CB+loE6uF3EvBmU8ftZpjkhM5wNlqQ1VKPg/uymkYzC/FO1QN7WEvgNlDK07aCHnWyvxTV0fGzsArfHlZEnjiUKVuWBn0FVsfzhNk3W8oURIdXUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZiFFaPzW; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZiFFaPzW" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7db238d07b3so7869a12.2 for ; Wed, 23 Oct 2024 10:23:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729704193; x=1730308993; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9hRnfiOV1eVShqlKq7FIoA/iABA9JXFy42N4zJaQbbo=; b=ZiFFaPzWGzaFzv58G1sO3oz5alvrlk6liw7meUI1pD/eE2y654ip5rNHMRmE7d+y3A bucco1XtInMHS1btdVnDJ1TNjBguQfLVJlp4Gn7tWjcjxyFbLn1lTqCTE7evResGyMiQ mg5ChaIBRAmSwbLQ2jYNtLSTWrqCPcwkBPJBnpPacOwbmxYcMImqeZOKGn/socEfbtPR AaHwTCsfqEgaifHazayTsaN2xucDb0GlZI2TUSASdEME/X7CDDRcyYDxAmTi7M9d3peL q610d1QNR+1qmW2ODWArI2fwES8yNzXe/2Nn6gkB4s4OOK72xSwKGsmN3/mDdczDbtrd +7lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729704193; x=1730308993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9hRnfiOV1eVShqlKq7FIoA/iABA9JXFy42N4zJaQbbo=; b=HzZGJ1kDYc/A9hoiCvRsb6MUvByurhy7V+RIz5n5BlJmEKevL0uG1pM73az5Zv1YvH bcw7Wc/nrfAGSojpm/rWehwK+hEneDBYPRc8qbs3yADeI4bfzInTRnuAop61sdMl4zz0 1OoURfDKF9oLFt1EG2w5FTJp1ixxfN9UM9iUfDd7QNRI3IHvNFcIlwjJJvznIjj0mKCr XAJLwLD29CavzSX9Bs4ypMvwMtzkIKo1zOP4Irle4XAfTcNn75jozkaWYmw8fah1Kb4q 1qyiukHatDEdVWMEyX9EECQdEkMbJ/mF/3XL8XV5Jc81L+i5H8pJTo0BLd20KiakLrov porw== X-Gm-Message-State: AOJu0YzgKs/+xH7eKdbuXqnZR8Wfod352dKl+Vp5+cjfXF60P4Kd05QG Cd3QVK2Hg1Fgp0otWAh1sLG09wmkmzlAQxOWFW1WedInFcj6aNQ2KitJky9U X-Google-Smtp-Source: AGHT+IFIBmuuHKyZUqlSCWTb6lbtt+NpnMdlBA5JER47f8DckM6gewQ7nLl9RiF98LCZ1JP8LabZYg== X-Received: by 2002:a05:6a21:a4c1:b0:1d9:239b:a125 with SMTP id adf61e73a8af0-1d978b1a121mr3925952637.15.1729704192983; Wed, 23 Oct 2024 10:23:12 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71ec1407ed7sm6551923b3a.214.2024.10.23.10.23.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 10:23:12 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/4] auto-t: add test for the new OweDisable driver quirk Date: Wed, 23 Oct 2024 10:22:57 -0700 Message-Id: <20241023172257.112771-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023172257.112771-1-prestwoj@gmail.com> References: <20241023172257.112771-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Tests that when OWE is disabled IWD will still connect to the legacy open network. --- autotests/testOWE-disabled/connection_test.py | 51 +++++++++++++++++++ autotests/testOWE-disabled/hw.conf | 7 +++ autotests/testOWE-disabled/main.conf | 2 + autotests/testOWE-disabled/ssidOWE.conf | 15 ++++++ autotests/testOWE-disabled/ssidOpen.conf | 9 ++++ autotests/testOWE-disabled/transition.open | 0 6 files changed, 84 insertions(+) create mode 100644 autotests/testOWE-disabled/connection_test.py create mode 100644 autotests/testOWE-disabled/hw.conf create mode 100644 autotests/testOWE-disabled/main.conf create mode 100644 autotests/testOWE-disabled/ssidOWE.conf create mode 100644 autotests/testOWE-disabled/ssidOpen.conf create mode 100644 autotests/testOWE-disabled/transition.open diff --git a/autotests/testOWE-disabled/connection_test.py b/autotests/testOWE-disabled/connection_test.py new file mode 100644 index 00000000..849cb58a --- /dev/null +++ b/autotests/testOWE-disabled/connection_test.py @@ -0,0 +1,51 @@ +#!/usr/bin/python3 + +import unittest +import sys + +sys.path.append('../util') +from iwd import IWD, Network +from hostapd import HostapdCLI +import testutil + +class Test(unittest.TestCase): + def test_autoconnect_to_open(self): + IWD.copy_to_storage("transition.open") + + wd = IWD(True) + + devices = wd.list_devices(1) + device = devices[0] + device.autoconnect = True + + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) + + testutil.test_iface_operstate() + + network = Network(device.connected_network) + + self.assertEqual(network.name, "transition") + self.assertIn(device.address, self.hapd.list_sta()) + + device.disconnect() + + def setUp(self): + self.hapd = HostapdCLI(config="ssidOpen.conf") + pass + + def tearDown(self): + IWD.clear_storage() + + self.wd = None + + @classmethod + def setUpClass(cls): + pass + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testOWE-disabled/hw.conf b/autotests/testOWE-disabled/hw.conf new file mode 100644 index 00000000..42b12d59 --- /dev/null +++ b/autotests/testOWE-disabled/hw.conf @@ -0,0 +1,7 @@ +[SETUP] +num_radios=3 +start_iwd=0 + +[HOSTAPD] +rad0=ssidOpen.conf +rad1=ssidOWE.conf diff --git a/autotests/testOWE-disabled/main.conf b/autotests/testOWE-disabled/main.conf new file mode 100644 index 00000000..2554c011 --- /dev/null +++ b/autotests/testOWE-disabled/main.conf @@ -0,0 +1,2 @@ +[DriverQuirks] +OweDisable=mac80211_hwsim \ No newline at end of file diff --git a/autotests/testOWE-disabled/ssidOWE.conf b/autotests/testOWE-disabled/ssidOWE.conf new file mode 100644 index 00000000..72809fa6 --- /dev/null +++ b/autotests/testOWE-disabled/ssidOWE.conf @@ -0,0 +1,15 @@ +ssid=owe-hidden +bssid=02:00:00:00:f1:00 +channel=1 +ignore_broadcast_ssid=1 +ieee80211w=1 + +wpa=2 +wpa_key_mgmt=OWE +rsn_pairwise=CCMP +vendor_elements=dd15506f9a1c02000000f0000a7472616e736974696f6e + +# You would conventionally use these options but hostapd does not include an +# IE for the OWE network, hence vendor_elements must be used directly +#owe_transition_ssid="transition" +#owe_transition_bssid=02:00:00:00:f0:00 diff --git a/autotests/testOWE-disabled/ssidOpen.conf b/autotests/testOWE-disabled/ssidOpen.conf new file mode 100644 index 00000000..096b52c4 --- /dev/null +++ b/autotests/testOWE-disabled/ssidOpen.conf @@ -0,0 +1,9 @@ +channel=1 +ssid=transition +bssid=02:00:00:00:f0:00 +vendor_elements=dd15506f9a1c02000000f1000a6f77652d68696464656e + +# You would conventionally use these options but hostapd does not include an +# IE for the OWE network, hence vendor_elements must be used directly +#owe_transition_ssid="owe-hidden" +#owe_transition_bssid=02:00:00:00:f1:00 diff --git a/autotests/testOWE-disabled/transition.open b/autotests/testOWE-disabled/transition.open new file mode 100644 index 00000000..e69de29b