From patchwork Wed Oct 23 18:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847802 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 5FDE21CACE8 for ; Wed, 23 Oct 2024 18:29:20 +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=1729708161; cv=none; b=mEisAXhJZ0uTBISHCOgHJRsi7uRzjnpsYrWml9cu36nWy+GiEEdjq3GlqbgEkMurJqPcW81ynT/+h857JGlr0FGyM4IL7krdJ143l3YQd/AiUeFsBePoUmRY1ih3NiHsFaQE3CqNSkAUnLoz3+OCHVEYB2EX8+yGvJ2y77b7JQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729708161; c=relaxed/simple; bh=Et6idfdvQ6toD2ed8vrwN4sya/GuqyrnOmrL2ZaeoL4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=XGr6uOE5qzy4yuCq0QW9EPb2oPYnPFEHpgRBhu4Bm5NA4QwKoU7frEyql0KZ4y5CrzOQZR52EHr308ORie2oa0XjXl++hIzkTT96tfrJPrQalnf4AMv+kbLf291XRj17O114bQy1zVn1eJzIhiGj2o3xPlIQVXeedKReBAUb74c= 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=YMAx8ZZW; 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="YMAx8ZZW" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7ea8ecacf16so57517a12.1 for ; Wed, 23 Oct 2024 11:29:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729708159; x=1730312959; 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=YMAx8ZZWt20R+9MktNcUhV8s+daF6bv2U6u/PLTdPPwo8+U1tYsDzigLfAi+C6aJ5P MVsacvIx8eU2nBuc38Txv7Y26631mcZA++CI8y7UWmRYDG2UARrYOYHTqCwuU/ur8Sgx tgp8J/EdalIWAALjV7PVWEKjGiayfW9ftldkHjQfzlNHUbC75P8ykjNjvz3b8xIfsUM6 bq/yh3XXQutfnxbR0EyRa39kUSpnSpOgaZaKU+udch91L8Ih/NCWAmNPggu4x+2gidY9 bm1Kkv+ZI6s1c2a76NtHLa0QcmUzKqElFfENFygDWrbTgx6mVtUZ5vBLPPvfgoBsSMXI JuWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729708159; x=1730312959; 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=fefStl5Aw9ZN1NoNDbJivuytSVf5qZ4MLtyiZC0Bgiz39Je+6L5+7i8QJ8CmyjJ0LA IjHBkt3Zzw2DcFDnPkK6F/t2etuiGegz/W4w2vwI4f9ZX8q+b0nFufNBAmE0utued1Hf pLro0kNMXro13dXHePDijQ+NfFzN5zup2YCEhMutz5j8Pe6cGdKnMphCSeciOKJRpMlr WJHEUNzq+Fy9fANoTPvVEHiwbNws8RbF/X/ImlLsgqZkzA4g1YJ0f9ixpDtcVBnC6d2g S9p8hvj170lMCNdOudGqT0ABYz1RvAqRYlw85JI18u8M5wEN1nPblhC36bNM/nvMVQLd pyRQ== X-Gm-Message-State: AOJu0YyI6rxv1amBPn8+KwocAyasAuGMuKFNvKvGabQl2LRgyD7fPVgb vQygiQG6bk5UtiUNmzdh2d5la6GpNQxq8yFLRpuQizgQe+AFB6VeH/RkoTZ2 X-Google-Smtp-Source: AGHT+IHAagNx5b+JSROXOYF2aNzT3zGxlo1EVoHW/Bbvh77GvFfHmqZmeGnVIiwmyZhU8TjWWuxbCw== X-Received: by 2002:a05:6a21:170f:b0:1d0:7df2:cf39 with SMTP id adf61e73a8af0-1d978ad5892mr3911717637.7.1729708159265; Wed, 23 Oct 2024 11:29:19 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeabc11a7sm7024871a12.60.2024.10.23.11.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 11:29:18 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 1/4] wiphy: add OweDisable driver quirk Date: Wed, 23 Oct 2024 11:29:09 -0700 Message-Id: <20241023182912.128388-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 18:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847803 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.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 CAAD91D0946 for ; Wed, 23 Oct 2024 18:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729708163; cv=none; b=f2jUEaqc1vda4T8R2jfYsJFGvG+6UGA78PGcg3780PMLhjCIQ6r/4qUAJs5e4r7xq88FBJZRreyRqJgt8ltiXROyeXeNW5/AAzWXyi+wyPcZ5G17w1gkhte4WF29f6cEChmaiTv+qr88hEGhZiSG75rJ4sRfN1CnixWo3RWWtws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729708163; c=relaxed/simple; bh=fy9saxEeOdAc2Inw7MDy0DT5tM/z2T3Vhe4JotQlYac=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BfxEtoYHxGrKp6nFpSq9gU9oeKuySgDHct6hRPfo1F7RS9/VU9RbQCPtO7ebbC84kCC0dqLWeH/lw3+LEooPNM4rG6VNAIg8EZe+ee3xw/5aYpTRyWz37NhUsOYsd8azZe9Vvu9P1IhZGsv0WqDFh9CwLMCDurAIq3mS+oaqc4Q= 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=kcQEVNBE; arc=none smtp.client-ip=209.85.210.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="kcQEVNBE" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71e4e481692so96343b3a.1 for ; Wed, 23 Oct 2024 11:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729708161; x=1730312961; 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=kcQEVNBE90o0CEETj292C1piNgkogdQBy+QlX8OAPzdn4NLvAt1OIC1ESCEuWglQc5 HoNQTDjIm3i4pLC261L2McgO8tZQwovpMBtsPfNFski0FgX90EKLN2chKEmifon84rlM 8Hmn22P4jA+xxYjM1RblkYZO/HRZqottY0++7Syi3EAQ4GIWWTYXO0ubRJ5OHTRbI8Qp x8FSNeVevdkY1EWk2Qp/aCHbC326MvXe32n07vhoJQKk6E1gkzis8BwePbHPthYsTYkf IgofmgxHt3KaZ86Y9MucmwVzJBfPTKKoe1hMKDbjf2Qg6f7rXUCJGWBMxJ3THgecpkI8 vduA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729708161; x=1730312961; 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=I1d8YE5bColCtiYAsn5F0dxxoix1MSxPmcrlhGg8p37kb1nya/lL4uBSs1wUlCzmJL 2v+IxVYh4tXt8rupZZgd4X93Xi/S+6hmissBZAIImQjVUBHuw5xamRTRGrONojLDUJJJ UOJtXPdgc1YgNbiCIT4SHWihuO0DkzGqx4r4Lok0mb5OBaSeYEioBQ0+Vf0nWulzZae5 Yu4nroaKlIIkzw7ULbUZm2qGYnDq9OMeDSQBMRh5UFKqbIE50V+Kb5QHKS92j3/Q/yB/ LKR7XyXiNgYQpoeiLobXfNss6nMq/efs2XWBM63j0v7o3/9YlNS6DH1l1P6MwKIh7SBT m2zg== X-Gm-Message-State: AOJu0Yx7uFSoEewzivSyNRgeaPpe65FzK3Pvov0h7BiyDio+emeyRkK2 QN8imLLeAIpfO06Qk9NaBCLU96/7LCSDZVzHIN63SSuKeY/U+SKi9tZAt6Id X-Google-Smtp-Source: AGHT+IGntKMqC8HFW5ciB37GbJ/Xi0You4dPy3FOSk08ORFQVtaCFc52olL9m/jSeNipF2bdTPZryw== X-Received: by 2002:a05:6a00:b89:b0:71e:452:13dc with SMTP id d2e1a72fcca58-72030bcce48mr4930516b3a.13.1729708160825; Wed, 23 Oct 2024 11:29:20 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeabc11a7sm7024871a12.60.2024.10.23.11.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 11:29:20 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 2/4] network: don't allow connection to OWE AKM if disabled Date: Wed, 23 Oct 2024 11:29:10 -0700 Message-Id: <20241023182912.128388-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023182912.128388-1-prestwoj@gmail.com> References: <20241023182912.128388-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 18:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847804 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 5B2231D0E13 for ; Wed, 23 Oct 2024 18:29:23 +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=1729708164; cv=none; b=Yvf0FLJ4/fVHxF7jBp49Rqnf8Y4Is/3Wbr8l330UkZu20G7xxYnxa2gQZqKVjBXp+ITFpFiqc7YcuLmcDPPxf1O0BLV65FbtdUM2dFwhaV+qeWlF/uqCk0RMGjmy6eHqzvH5zuIUUnDr6srLfn7l5EYBLr6+pmRavsniGxOD/co= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729708164; c=relaxed/simple; bh=hUc3JMsSH9MJrzBwRge9tDni+5tOZDKc6AHr4/PuXJQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l90WZ54PEhgHaWe9LpN9wcrJ925qijNLHMHX08BsH9DSvr+vcOH/wFsBQZhIkvEA8Q299vfqUYBjBr9h4+BOn8MDFgTIaepUidjoIbMtASumMS3JTltK0Kwf2otN1tBE1U2HynYTlMpl255JIXN97dY3KMrs2y10tTfvH8HMhjg= 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=AcOJRn/l; 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="AcOJRn/l" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7ea12e0dc7aso51753a12.3 for ; Wed, 23 Oct 2024 11:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729708162; x=1730312962; 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=aP1EsuKzBrfHY7uwCOVu6kTse0CaJzkRX4cZQ4vWMmY=; b=AcOJRn/lKNfc6HeTfnHeYLIGaWSmK+MAs2DzUEAD02RSDlzMw0A3VjP04plQubXEcr WpY26rMUKmsGTY9cbMdwgf9h+ZjoXYwdj3ppdYd+5FhB+7v6A4v+XV6Zd7TaoxrCaLeg fQWFPNacRwVRdDyBTOAMkDEiRFftR/iMUf20GUhIitZvC/ZzmzJS4h4+Jq7RrChvxiZQ rENaUVyO0FSGC1oyP5tr20LvHvtSXia8GgS6okkz1s2EAki95Pnw71TQFUkqnAhl/I+/ Wkp9jWSKZ0a08MeQH0VdCGT74dfhI/liM9Gxt2R2BE+438A+ho0sfYFy8lv0Qxoyaa84 NDDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729708162; x=1730312962; 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=aP1EsuKzBrfHY7uwCOVu6kTse0CaJzkRX4cZQ4vWMmY=; b=OqR+dHqebJVflQnORWAG2lVvhjCuUMIY+vx7N5i9jWBKQM5fkuOueF8GFWNJ2AXEi7 LssjJwRHQpDhQAGFP4HsmGlM4DNBVPNzvTVqmssSRYIOZjIRffHgS3VhdhdQfRWC0BOi z2SxI4dn6A9LamQTGybLOuMBS1ShADK13hqqXFq04r+7FnDwqbKqw3WfJ5vCO6NErlJO KSSUVCruD2Y/Ck8J32gFi36/EQSgTTftZb6u3OoYnhh1VPa68vU7/jooeESIDMeIgkZd BaEkf+i6WgxacS4my3N2RmhPo2+lK/JEA6z73g5oDSyCcLwmCpjPn2NilodqTsDLhW84 k63g== X-Gm-Message-State: AOJu0YyPri9BOPaO9B3i/0gWIl4ASpnXqlA6K7oLf0XN7rIcZZNebpdh EOHRIMZo/YVgYO3FRvLYOKJ4zFMCrLyleYpNFPuQhMZX9x2q/1m4cGcC45dN X-Google-Smtp-Source: AGHT+IGp+JwKcN1W/SmMPIm/pSvTCzRfHIYjzdg0V/L7aAydrZGhW8zjAxArQQ/pE1G/WB7ja1v/7Q== X-Received: by 2002:a05:6a20:438e:b0:1d9:6d08:4b43 with SMTP id adf61e73a8af0-1d978b37d6cmr4400169637.22.1729708162437; Wed, 23 Oct 2024 11:29:22 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeabc11a7sm7024871a12.60.2024.10.23.11.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 11:29:22 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 3/4] network: fix OWE transition BSS selection Date: Wed, 23 Oct 2024 11:29:11 -0700 Message-Id: <20241023182912.128388-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023182912.128388-1-prestwoj@gmail.com> References: <20241023182912.128388-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(-) v2: - Fixed issue where the loop returned the first candidate, not the actual BSS that its currently checking. diff --git a/src/network.c b/src/network.c index 5a856fb4..cd8b0ee9 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 bss; } /* * 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 18:29:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13847805 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 F11EF1D0E2B for ; Wed, 23 Oct 2024 18:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729708166; cv=none; b=LWzJwc2GPRUFk3qPLr+1Uxqpqv8LJM+ie2JTx4SwYSK2QiH0B9aiXrRBZOl1+5GNeV9t/3/wLcBlg7m7X6nK3GEsI2/pI2qC1z2EI04f6hlzPTZl43ISER5kycpN2wt5bysrKNzXU9QrQ/oW0+qHzlNvj1PFc69IpxQ3I6uIDjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729708166; c=relaxed/simple; bh=NpeRjzndCNRsacZyfxijkggR7qWgKwLo1+H6PAtbo7Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JDkhqNNKinSWctOyqKBW2PedH7805/tX11SIMlwAfWCW1qNMl3nPDmCFDLihF81THsBYBLs3Zx1H9VQfyZQAFJpwwL6M58MUyX2UhuXSGgqcnoZkRnvyZ7KiV66Br7FLhQJjqnXy4bP0hhJz4Z9hVnP2u7xkxCjYAmPbCIUT5fk= 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=WjhjkgAA; arc=none smtp.client-ip=209.85.210.172 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="WjhjkgAA" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-71e6cec7227so110931b3a.0 for ; Wed, 23 Oct 2024 11:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729708164; x=1730312964; 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=WjhjkgAAEvBPMpZ7oeN13Uu5zY92dGLDhQzT2hd1VXOy5e6DGDdYAXlBJQ5Y1NOmWB 6LH6BuPotZuxO/uHWZoVwFq/Y2qZxkQdr0/hQ6CwWDv5e2105UFD1pxFLAiyqS8VzD3F mi/sPmT9iExjX9dla1WOO7s3o9kKtQ5fCBxC8fYafj+4lQ2XSVchpzIml+7gF1SPok8S SblmN6NkrQsoGjwryNjhHaaaZpmv8DcbKSvEvoO92GgjPkixPepK/tvpK6d8joxzAL+t KSQxp4QmrsjQNq4bv+s8kmKufdSVljIgfh6NJH4Hkjm2wRw4Csjf+QW9kpJu5k37biEm w3TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729708164; x=1730312964; 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=a74tnFywjhTFsFDv1l2Uwx9Lc/OwKSrYWQX7NVviRpOBCl8cc1rGyJY5fvZB2BfhgR FJktG5tJ7g7iYvyaj0HBFIMMvpkWzSdv90jBPf2A7PuHS1YQGp35B84M7sqbUC/z1A5z 17bNxhHVOjo0iFnJbK34ooo/+rB14366xNn1w9UZ5ufF7RMLsudXdPkpZt+dz1pPiwKF AUu9MajDvnpRI9BuOuK37AgqcxBSimICk2MW0HV2n2AFMQ0qIUTYiHZ/g1QKYPszn8Ig fBkDG70rES4kHsBmpgqNvCNc388XBUPP2+kwmqJVuMohaB5eaKQz2tIJlCLvdC2sJCGv nzjQ== X-Gm-Message-State: AOJu0Yy0WaWsefprQ4JD81i7ZYynOqP46DFZaGH6TT1NHGrDDuOCuCkw ly3d8RjbK15hWLzUPNQ6hfWkA8XN8iAE/D0DrbCXIXVVyROWJYJbcaYpcy+6 X-Google-Smtp-Source: AGHT+IEQancsDBv5RSVB1vKQnB/M+UvodXi0CNsJw/MlC1wuIwub5LfUmR5qdMPhTu4GK/BiON03bg== X-Received: by 2002:aa7:88cb:0:b0:71e:1722:d02c with SMTP id d2e1a72fcca58-72030a79c21mr4997211b3a.3.1729708163967; Wed, 23 Oct 2024 11:29:23 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7eaeabc11a7sm7024871a12.60.2024.10.23.11.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 11:29:23 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v2 4/4] auto-t: add test for the new OweDisable driver quirk Date: Wed, 23 Oct 2024 11:29:12 -0700 Message-Id: <20241023182912.128388-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241023182912.128388-1-prestwoj@gmail.com> References: <20241023182912.128388-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