From patchwork Wed Dec 6 20:17:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482224 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 743B347F5B for ; Wed, 6 Dec 2023 20:18:08 +0000 (UTC) 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="AfuxFzTX" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6ce32821a53so202448b3a.0 for ; Wed, 06 Dec 2023 12:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893887; x=1702498687; 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=+xwFQUTrHOLX7y/IAk/sto27WOQCKLdXHLGZNIDFn+M=; b=AfuxFzTXcPlHSzXbTq+XsWVhF9ot5jWOVFLFv4OEf88LLBmiciRDpVlp+sHY6IZ6Lq lwLxD05owrW7jJQ6+fZM0Fe2AxGhd4nqgWclkbUCHSidUe6xtET7G6h59cxZuldY0lmd ptsnoy40wVWXx1KJFZEmqNiKB0+q05KNJHFQ8LotKwylYdN0KaX7xrkqcdEVB0YEgcwa KDEe9bYPGF74L0YxxoHKLAWb1bidQU5wYnyoe9tzFxMteluRcAqyO7ZVq0cy7gbJ5k82 kxfayDfLE7jwdCbvbPs5P/DJjXREMfofk5VuCdneEZE8DgMKMIM080pZl6SdfMCnyAIB 4n7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893887; x=1702498687; 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=+xwFQUTrHOLX7y/IAk/sto27WOQCKLdXHLGZNIDFn+M=; b=Nqi+SKVHeHpdHveiKU9gu7RdZaM0RNheWoPMZzdIJdilCY4yQnTdFw/TYnWVUwJlTT PDPXqRSZH8c5XMaCCa+yCLs7vc0deSQNWwc25jI/vAkxLo1Ze9pJq2DcJVRAdxk3GaD0 9aQ2vRxLKD66rJbryPgV+71vOWaNE94aconMt8m63SQUAY0L3jV8QMQZ7WtZLjtjTm8/ Xqsr7DoftJsxmhuHmw7/z2SnvbqWGMnzRuAj3Wn3aRsgwBh9luQY9bSjrzuXo2ivQKjG xuWNojuvvjTcjfgIMW3qzM8Tqmz4vjRyIpCn1X43Ch3998vvOHGmis87R3qikArr01ZQ hWFg== X-Gm-Message-State: AOJu0YwOtw1NykDKDJfAVPU4Nr0+thACrzJWkXkPgD4niqqOg1+KXNf9 4umMnwk3iz5gyk0R8p+Lw3joahJmLMKSXg== X-Google-Smtp-Source: AGHT+IH2YaoJuGaSa1EmoyHRhKc6RxNzYqVwH2HCrWxvY8SvqEDl5zYRHvJAoEwNMwdq1Pi6dc6USg== X-Received: by 2002:a05:6a20:748d:b0:180:d33d:9256 with SMTP id p13-20020a056a20748d00b00180d33d9256mr1445109pzd.58.1701893887302; Wed, 06 Dec 2023 12:18:07 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:07 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 01/13] auto-t: add explicit stop() to IWD class Date: Wed, 6 Dec 2023 12:17:50 -0800 Message-Id: <20231206201802.2139649-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 If tests end in an unknown state it is sometimes required that IWD be stopped manually in order for future tests to run. Add a stop() method so test tearDown() methods can explicitly stop IWD. --- autotests/util/iwd.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 3f200beb..b1a57cab 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -1363,6 +1363,10 @@ class IWD(AsyncOpAbstract): self.psk_agents = [] + def stop(self): + if self.namespace.is_process_running('iwd'): + self._iwd_proc.kill() + def __del__(self): for agent in self.psk_agents: self.unregister_psk_agent(agent) From patchwork Wed Dec 6 20:17:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482225 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 06EF448CFA for ; Wed, 6 Dec 2023 20:18:08 +0000 (UTC) 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="Yo+zauh3" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6ce72730548so218736b3a.1 for ; Wed, 06 Dec 2023 12:18:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893888; x=1702498688; 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=eVHMO7Otc6oGvuT5BowEFRQ4zTPllN713Scz6cm8/k0=; b=Yo+zauh3q/P09g8cY99MrTWimcUx9JoLgUExP/tuvEBqMQwEl50E2WPXOn4aNXV3Ki rQZviBHEE43Ln9wvs/C4Sd8vNtVts5SVrHujf76cEEJxyssx8WyzXjrQi1FiGuMnqtxk eHp/TIyLOYworVETvLJkOquVh+z3+LSkxtqK3lA1uIxLB54u+dujxfPv4yYvfkdeUZJP SzC12RbSU1fX+9Li4U7beoeR008U2gi7z28MtqT1jOLTYPCxELr2u9ar8nh734l/wlGH FF4LrMi4d/zMJn/vY59wzoE/3FoB/bBygJ/zsF16zZG8CQVo/pk7YiEULiyoXIaVO2nU pEhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893888; x=1702498688; 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=eVHMO7Otc6oGvuT5BowEFRQ4zTPllN713Scz6cm8/k0=; b=WCYtyunVmaQQbcE0TyVNbDI2kWpdGjrW2d3c/aKbjfIT78x+xrKh4CaGUvGJmUeaYN XNXgNYNpSpWsE9qEWczVXUepgJn9+TFlN026Ua52V8TjfpWW/YXpzRmMvIt5zhpzdSSl AzL+3/ASEzxE7beqxUyXhg7uAqRD+3e8+yiwYiH6+wvEIf/rtYVy8tBClKycGlMXKehH 8WBMq2yKpkBlxqbc0F9MU0OekOBp2eA75LeJhbox5XY8zWjzc2p9oY2PpcfnMLsxMA3B 0u+YdH67cuB90BnqWJItqOaTRes5WMy9ur3/yDTbiXJzRAnZm1PWJ2gcm0ZsiWcNQZWg ndyA== X-Gm-Message-State: AOJu0YyZOLci3v4LOwtDuOdUZQy9Qwbr2JR3FePusLAuHpn5mow788Qo V1PLK3EXSO4Km9cHyp9IXqtEpi/sQPId5A== X-Google-Smtp-Source: AGHT+IEEuLaKa/BCPR5OnELRfXMX5CPm9ECsMwPS9AmAxq6s5hoYbNDW9KSxVc7eB4k46fxUbv65qA== X-Received: by 2002:a05:6a00:4396:b0:6be:314c:16cb with SMTP id bt22-20020a056a00439600b006be314c16cbmr1699557pfb.10.1701893887793; Wed, 06 Dec 2023 12:18:07 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:07 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 02/13] auto-t: add association timeout test Date: Wed, 6 Dec 2023 12:17:51 -0800 Message-Id: <20231206201802.2139649-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This tests ensures IWD disconnects after receiving an association timeout event. This exposes a current bug where IWD does not transition to disconnected after an association timeout when FT-roaming. --- autotests/testPSK-roam/failed_roam_test.py | 56 +++++++++++++++------- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/autotests/testPSK-roam/failed_roam_test.py b/autotests/testPSK-roam/failed_roam_test.py index 90f07f6b..d42002d4 100644 --- a/autotests/testPSK-roam/failed_roam_test.py +++ b/autotests/testPSK-roam/failed_roam_test.py @@ -46,11 +46,9 @@ class Test(unittest.TestCase): self.rule2.enabled = True self.rule3.enabled = True - wd = IWD(True) + device = self.wd.list_devices(1)[0] - device = wd.list_devices(1)[0] - - self.connect(wd, device, self.bss_hostapd[0]) + self.connect(self.wd, device, self.bss_hostapd[0]) self.rule0.enabled = True @@ -63,10 +61,25 @@ class Test(unittest.TestCase): # IWD should then try BSS 2, and succeed device.wait_for_event('ft-roam', timeout=60) - self.verify_roam(wd, device, self.bss_hostapd[0], self.bss_hostapd[2]) + self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2]) self.bss_hostapd[2].deauthenticate(device.address) + # Tests that an associate even should cause a disconnect + def test_ft_over_air_assoc_timeout(self): + self.rule2.enabled = True + self.rule3.enabled = True + self.assoc_rule.enabled = True + + device = self.wd.list_devices(1)[0] + + self.connect(self.wd, device, self.bss_hostapd[0]) + + device.wait_for_event('ft-roam', timeout=60) + + condition = 'obj.state == DeviceState.disconnected' + self.wd.wait_for_object_condition(device, condition) + # FT-over-Air failure with Invalid PMKID, should reassociate def test_ft_over_air_fallback(self): self.rule_bss0.signal = -8000 @@ -81,18 +94,16 @@ class Test(unittest.TestCase): self.bss_hostapd[2].set_value('ft_psk_generate_local', '0') self.bss_hostapd[2].reload() - wd = IWD(True) + device = self.wd.list_devices(1)[0] - device = wd.list_devices(1)[0] - - self.connect(wd, device, self.bss_hostapd[0]) + self.connect(self.wd, device, self.bss_hostapd[0]) # IWD should connect, then attempt a roam to BSS 1, which should # fail and cause a fallback to reassociation device.wait_for_event('ft-fallback-to-reassoc', timeout=60) device.wait_for_event('reassoc-roam', timeout=60) - self.verify_roam(wd, device, self.bss_hostapd[0], self.bss_hostapd[2]) + self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[2]) # Trigger another roam self.rule_bss2.signal = -8000 @@ -100,11 +111,11 @@ class Test(unittest.TestCase): device.wait_for_event('ft-roam', timeout=60) # Ensure an FT roam back to a properly configured AP works. - self.verify_roam(wd, device, self.bss_hostapd[2], self.bss_hostapd[1]) + self.verify_roam(self.wd, device, self.bss_hostapd[2], self.bss_hostapd[1]) self.bss_hostapd[1].deauthenticate(device.address) condition = 'obj.state == DeviceState.disconnected' - wd.wait_for_object_condition(device, condition) + self.wd.wait_for_object_condition(device, condition) # FT-over-Air failure with Invalid PMKID. The ranking is such that other # FT candidates are available so it should FT elsewhere rather than @@ -122,11 +133,9 @@ class Test(unittest.TestCase): self.bss_hostapd[2].set_value('ft_psk_generate_local', '0') self.bss_hostapd[2].reload() - wd = IWD(True) + device = self.wd.list_devices(1)[0] - device = wd.list_devices(1)[0] - - self.connect(wd, device, self.bss_hostapd[0]) + self.connect(self.wd, device, self.bss_hostapd[0]) # IWD should connect, then attempt a roam to BSS 1, which should # fail and cause the rank to be re-computed. This should then put @@ -134,12 +143,14 @@ class Test(unittest.TestCase): device.wait_for_event('ft-fallback-to-reassoc', timeout=60) device.wait_for_event('ft-roam', timeout=60) - self.verify_roam(wd, device, self.bss_hostapd[0], self.bss_hostapd[1]) + self.verify_roam(self.wd, device, self.bss_hostapd[0], self.bss_hostapd[1]) self.bss_hostapd[1].deauthenticate(device.address) condition = 'obj.state == DeviceState.disconnected' - wd.wait_for_object_condition(device, condition) + self.wd.wait_for_object_condition(device, condition) + def setUp(self): + self.wd = IWD(True) def tearDown(self): os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') @@ -154,10 +165,14 @@ class Test(unittest.TestCase): self.rule_bss0.enabled = False self.rule_bss1.enabled = False self.rule_bss2.enabled = False + self.assoc_rule.enabled = False for hapd in self.bss_hostapd: hapd.default() + self.wd.stop() + self.wd = None + @classmethod def setUpClass(cls): hwsim = Hwsim() @@ -178,6 +193,11 @@ class Test(unittest.TestCase): cls.rule0.prefix = 'b0' cls.rule0.drop = True + # Drop Associate frames + cls.assoc_rule = hwsim.rules.create() + cls.assoc_rule.prefix = '20' + cls.assoc_rule.drop = True + # Drop Action frames cls.rule1 = hwsim.rules.create() cls.rule1.bidirectional = True From patchwork Wed Dec 6 20:17:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482228 Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (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 D4D1C6F604 for ; Wed, 6 Dec 2023 20:18:09 +0000 (UTC) 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="EJItDT/Z" Received: by mail-oo1-f51.google.com with SMTP id 006d021491bc7-58e256505f7so78835eaf.3 for ; Wed, 06 Dec 2023 12:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893888; x=1702498688; 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=Rj82y449AvkdKesQQUHyj+VdUVbSc8ccNljz1Eh1eO4=; b=EJItDT/ZAAv1mXUMo3X3sDJt11XkQik4FhPQqRocUMIbses925z/rTod33jCGrG/Ho nFX9lYmrKDXeKQ2AkkGChX0+uBRgrdnKRsXwXCYN/AW9RmRmjDYZsfNfz8qumeO5/QVG JkmkLotq2DswO0BPMPSWuk9nSF0MV6j1XJhgMbsn4TWPplhkNNiirr8FqsViB4SNCik7 2ycoHfNpqMTwOb/SYJNV51rksaPVtsVzfT3vhThO9a/ybkb/BP9kq5r8EHI3XjJN1d31 oR48kqIUSjASclPGpyQFIduBH+17vN6OLxI9DgARSFuQmhz1bkRpzDnXUAxQJVefflGW fUjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893888; x=1702498688; 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=Rj82y449AvkdKesQQUHyj+VdUVbSc8ccNljz1Eh1eO4=; b=sfvr3GlElrMrlZwk5d6zK/fzrOOlWNA4bL8lVzNhmBf9SRx4uoTHn16X2GDNnUkCDa pfqXeNd64S8x7UPrnQ5o9r13isFDyux9VDlj8UdL/Rkh/eGtgKkPXT+eyt8o2y0wrCyx 1XWzDD2Kpegu9Cps+dmzVUL2tARYUzoIHW+xdWCKgG/uvjiHFU7byBgijQZFITnkYc7p QKujqAUCqu8QguwYMnIdX0OrvRBdk5xsoi7rE9dTX8/y60KWNSEPJMlYlf+XJUtwd6X3 1FxdE5kkTtY6EuuY3+VpaVveR0+M+4fGKVE76UXNlJ0pXf3mXURx88Z4drNzcjefMl3g uCnA== X-Gm-Message-State: AOJu0YzNGs39NgLLJnKIFL11IG+YL4PwW0eSoLQATbVJfGBM0zp/faS5 +E2no9YvEjl3e+vv0rZ8NU5Fo0WPJn+aZQ== X-Google-Smtp-Source: AGHT+IF9MaNEwfbTosqtadyhFekmmCbOuuprDHgipfvuZFnyBP32bJGAbdtHm2mB7EGcIYKcN4I5WQ== X-Received: by 2002:a05:6358:60c3:b0:16e:33e:3a9c with SMTP id i3-20020a05635860c300b0016e033e3a9cmr1992298rwi.6.1701893888500; Wed, 06 Dec 2023 12:18:08 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:08 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 03/13] auto-t: only call set_value for changed values in default() Date: Wed, 6 Dec 2023 12:17:52 -0800 Message-Id: <20231206201802.2139649-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The default() method was added for convenience but was extending the test times significantly when the hostapd config was lengthy. This was because it called set_value for every value regardless if it had changed. Instead store the current configuration and in default() only reset values that differ. --- autotests/util/hostapd.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py index 1b1bc399..cee08092 100644 --- a/autotests/util/hostapd.py +++ b/autotests/util/hostapd.py @@ -75,6 +75,8 @@ class HostapdCLI(object): if self._default_config.get('vendor_elements', None) == None: self._default_config['vendor_elements'] = '' + self._current_config = self._default_config.copy() + if not self.interface: raise Exception('config %s not found' % config) @@ -170,6 +172,8 @@ class HostapdCLI(object): if self._default_config.get(key, None) == None: raise Exception("Untracked setting '%s'! Please set default in hostapd config" % key) + self._current_config[key] = value + cmd = self.cmdline + ['set', key, value] ctx.start_process(cmd).wait() @@ -200,7 +204,10 @@ class HostapdCLI(object): def default(self): for k, v in self._default_config.items(): - self.set_value(k, v) + # Only bother setting the value if it differs + if self._current_config[k] != v: + self.set_value(k, v) + self._current_config[k] = v self.reload() From patchwork Wed Dec 6 20:17:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482226 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 2A83B6EB72 for ; Wed, 6 Dec 2023 20:18:09 +0000 (UTC) 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="eNNSxxhi" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6ce94f62806so192523b3a.1 for ; Wed, 06 Dec 2023 12:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893889; x=1702498689; 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=WAY4bt0O+virkaMM/crr7PzAI4YN/UAAgk6iGrGxQ+4=; b=eNNSxxhie5cxzcbPy6iwgOIsNR4zO1QE/v4bxbUhDBGfKICP6ZxIOlqTb2CRobxnAf Yb0yqVDXDfO8z9SoIWCDx5E23vPXxpDQE8OFDhvAxVgguGFiWzgBslpCj8kiUxVlcJmB 8iylr+ra4KYFnoieUtIpSpVWjG8rUtg+g5ggG2o8PmHG/W1uHQp13dZIW9p42MD7xoXh lUNMd+JujP261WceMR1vU02mUNFJRoGY5Lcd0+8SWhN5645IDSigt8dIFqxNF6nfb+Ak S2WZM0TtCBE/5nd4y+3R6UKNMjOCJ157ULsh96tkzG4ILy5PFl4lousOUe/VLvyl4Lj6 r+6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893889; x=1702498689; 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=WAY4bt0O+virkaMM/crr7PzAI4YN/UAAgk6iGrGxQ+4=; b=Y22gVfKbp7M2wN3EybBuUwHValx5krVAsW1jAxiJktdexJeR1nPv7JMFBs3d8HKXLD 6YN82xq4BZdaXO1jIn1xIib00Jukv4kgL3KtlTr1qLQjuWINoL8CjsqDromUQS3rejnU awwURdhP98I0yys43FzJi+1bnzTXnhesfOK06yh9cAmJTgf7Te4PfKpcR6I2t3iFGFss J8bIc4y2Onrpe+1vM5iqH1WiwovVZvy7qTqT8Eld4Fcn7FesDReC9LRFa84E+eTg+hUi 9a7LlhHrb7HEu42mmFGr3FVVabHbp2F2Z5IxwRtSxsCOU+tWF/5HuE2lUOBsBY+Jf2zd hPpA== X-Gm-Message-State: AOJu0YzHswCN6mM88EAYQC48FS9L/IMUmJ7Bzlytq8EaDGkRPbXQq29E zHNFWRMlaeXc6WH4BP1UskCIsBPYCUyosA== X-Google-Smtp-Source: AGHT+IHKtLBb+4rjuubyIkSN9WjdFKOwexf6sHpu0eiiSbJj79drnZw5/zRw5Ayker52psUSkUJsNw== X-Received: by 2002:a05:6a20:7d8d:b0:18f:f637:99d1 with SMTP id v13-20020a056a207d8d00b0018ff63799d1mr445126pzj.57.1701893889076; Wed, 06 Dec 2023 12:18:09 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:08 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 04/13] handshake: add setters for authenticator/supplicant_fte Date: Wed, 6 Dec 2023 12:17:53 -0800 Message-Id: <20231206201802.2139649-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In general only the authenticator FTE is used/validated but with some FT refactoring coming there needs to be a way to build the supplicants FTE into the handshake object. Because of this there needs to be separate FTE buffers for both the authenticator and supplicant. --- src/handshake.c | 14 ++++++++++++++ src/handshake.h | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/src/handshake.c b/src/handshake.c index 1c5ed2c9..f35da9b1 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -123,6 +123,8 @@ void handshake_state_free(struct handshake_state *s) l_free(s->supplicant_rsnxe); l_free(s->mde); l_free(s->fte); + l_free(s->authenticator_fte); + l_free(s->supplicant_fte); l_free(s->fils_ip_req_ie); l_free(s->fils_ip_resp_ie); l_free(s->vendor_ies); @@ -313,6 +315,18 @@ void handshake_state_set_fte(struct handshake_state *s, const uint8_t *fte) replace_ie(&s->fte, fte); } +void handshake_state_set_authenticator_fte(struct handshake_state *s, + const uint8_t *fte) +{ + replace_ie(&s->authenticator_fte, fte); +} + +void handshake_state_set_supplicant_fte(struct handshake_state *s, + const uint8_t *fte) +{ + replace_ie(&s->supplicant_fte, fte); +} + void handshake_state_set_vendor_ies(struct handshake_state *s, const struct iovec *iov, size_t n_iovs) diff --git a/src/handshake.h b/src/handshake.h index 815eb44f..e6344048 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -104,6 +104,8 @@ struct handshake_state { uint8_t *supplicant_rsnxe; uint8_t *mde; uint8_t *fte; + uint8_t *authenticator_fte; + uint8_t *supplicant_fte; uint8_t *vendor_ies; size_t vendor_ies_len; enum ie_rsn_cipher_suite pairwise_cipher; @@ -215,6 +217,11 @@ void handshake_state_set_ssid(struct handshake_state *s, void handshake_state_set_mde(struct handshake_state *s, const uint8_t *mde); void handshake_state_set_fte(struct handshake_state *s, const uint8_t *fte); +void handshake_state_set_authenticator_fte(struct handshake_state *s, + const uint8_t *fte); +void handshake_state_set_supplicant_fte(struct handshake_state *s, + const uint8_t *fte); + void handshake_state_set_vendor_ies(struct handshake_state *s, const struct iovec *iov, size_t n_iovs); From patchwork Wed Dec 6 20:17:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482227 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (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 9302D47F5B for ; Wed, 6 Dec 2023 20:18:10 +0000 (UTC) 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="fXw+aJ1d" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5c6734e0c22so127796a12.0 for ; Wed, 06 Dec 2023 12:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893889; x=1702498689; 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=iDqoM7QjlNAhdyKyErUpySXKYYw4XfwYgeohnydEEw8=; b=fXw+aJ1dzQ+YC+sC2rVheVHzYzv5BND9WqlqGboTDig05qm93yVZM+ZifvADvjbEjp L8+PvQJYWUv84MLIbZab0btYQ2snpUo8UmKJqTof3VqMIi1iVg5sr5IJnaFhGopNPfLq QpwtoHbFjSx4q3XhhXY2MLxTD6cxZeE9bjSvZE9qsV0CCdyQ2NBpyaKUqVccZUS/M2Gp AVqEFxTP1IayIoTbV1v7RJY0GgFX8diQo/+3EkUlftVt3gjfjM6vfqabXFJj5duPg9Ku 0q42d6n83MXfyMi+ayLH1dAM7qleHgbC7GIGCiS2NA+PVjOhIjfaAoh6puQM2gAtj043 5oAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893889; x=1702498689; 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=iDqoM7QjlNAhdyKyErUpySXKYYw4XfwYgeohnydEEw8=; b=wM520JpqEVNAqtGNttSBV9qtP5YluzlJVbt4P/intHl35q/jFypNdwpwMJ4kfn7qxE vt0YlYedw4wv9+DtlK2bIBPuAE91nDTjYx+Ugsafy1g6VPLlpZsSHaCdKz0l+tJlySBG LJVWMJFNeeojFpji0C0XynTsN82LjEeTik9yJq1Uzj9kpfdMigMO7uOwT/9kyjBMv3+p Q68QMy7dNDTP+tF7dlpkMqPI7Qoh3LrD20hnpcvExSpspR/ICbhCnEjub4tx/+RNVI4m WBDBy5mcKLQ1ypAx78Ds1NpPlnzWnHc6ksqq+XwzsTtgq06nnmGz1k7YwIVsmsZ4wpkn iBaQ== X-Gm-Message-State: AOJu0Yy2buiHEbn4CReLlfbiaq0vp+wLOsKykUBS6PnU453/jbuwFUkv K/AE33DHlIKZ2B0067Vr65ibCmZI7p3iqg== X-Google-Smtp-Source: AGHT+IGDLlcYOQGzwu2GQswsQyzAYKex4c38+R+RPCbzmLzHH+EKkN0BK0oAFeBOys1kvfHmT3g5TQ== X-Received: by 2002:a05:6a21:149a:b0:187:b14f:a2a with SMTP id od26-20020a056a21149a00b00187b14f0a2amr1149556pzb.20.1701893889548; Wed, 06 Dec 2023 12:18:09 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:09 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 05/13] handshake: use authenticator_fte instead of 'fte' Date: Wed, 6 Dec 2023 12:17:54 -0800 Message-Id: <20231206201802.2139649-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/eapol.c | 5 +++-- src/fils.c | 2 +- src/ft.c | 2 +- src/handshake.c | 2 +- src/netdev.c | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/eapol.c b/src/eapol.c index 3d7b3d38..bad4bbb7 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -1299,7 +1299,8 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm, ies_len = ies[1] + 2; ies_len += append_ie(ies + ies_len, sm->handshake->mde); - ies_len += append_ie(ies + ies_len, sm->handshake->fte); + ies_len += append_ie(ies + ies_len, + sm->handshake->authenticator_fte); } else { ies_len = append_ie(ies, own_ie); } @@ -1795,7 +1796,7 @@ static void eapol_handle_ptk_3_of_4(struct eapol_sm *sm, if (eapol_ie_matches(decrypted_key_data, decrypted_key_data_size, IE_TYPE_FAST_BSS_TRANSITION, - hs->fte) < 0) + hs->authenticator_fte) < 0) goto error_ie_different; } diff --git a/src/fils.c b/src/fils.c index c3337352..f876e7e5 100644 --- a/src/fils.c +++ b/src/fils.c @@ -445,7 +445,7 @@ static int fils_rx_authenticate(struct auth_proto *driver, const uint8_t *frame, kck_len, &ft_info) < 0) goto invalid_ies; - handshake_state_set_fte(fils->hs, fte); + handshake_state_set_authenticator_fte(fils->hs, fte); handshake_state_set_kh_ids(fils->hs, ft_info.r0khid, ft_info.r0khid_len, ft_info.r1khid); diff --git a/src/ft.c b/src/ft.c index 2cc611b8..43399828 100644 --- a/src/ft.c +++ b/src/ft.c @@ -922,7 +922,7 @@ static void ft_prepare_handshake(struct ft_info *info, memcpy(hs->snonce, info->snonce, sizeof(hs->snonce)); - handshake_state_set_fte(hs, info->fte); + handshake_state_set_authenticator_fte(hs, info->fte); handshake_state_set_anonce(hs, info->ft_info.anonce); diff --git a/src/handshake.c b/src/handshake.c index f35da9b1..ad8533f4 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -528,7 +528,7 @@ bool handshake_state_derive_ptk(struct handshake_state *s) IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256 | IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256 | IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384)) && - (!s->mde || !s->fte)) + (!s->mde || !s->authenticator_fte)) return false; s->ptk_complete = false; diff --git a/src/netdev.c b/src/netdev.c index f2e887b4..b9dc930e 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -2777,7 +2777,7 @@ process_resp_ies: */ if (ie_parse_fast_bss_transition_from_data(fte, fte[1] + 2, kck_len, &ft_info) >= 0) { - handshake_state_set_fte(hs, fte); + handshake_state_set_authenticator_fte(hs, fte); handshake_state_set_kh_ids(hs, ft_info.r0khid, ft_info.r0khid_len, From patchwork Wed Dec 6 20:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482230 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 3442E6F617 for ; Wed, 6 Dec 2023 20:18:10 +0000 (UTC) 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="nJvJATrK" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d05e4a94c3so1399935ad.1 for ; Wed, 06 Dec 2023 12:18:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893890; x=1702498690; 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=8htIAC9kRG6RYa6OvogGIifB3FzQt1zgdxaJBwAA+IQ=; b=nJvJATrKbMg09Wj7a4W2yab+rf5AEC9UQ1s+MiAxAYZGzBVZdPKWrCGfmZE2voAwsB vSj3oFrqCNeILo9ROw0V9KAueAxA+4d/AQvBwG18QkKCp1Cpmt1Ays/VAIsH3u/ATDn/ 1YkqH0O5ZsIQ+NhHxTh/eD1vTkqbS8sC36PvGPcbfRf8squ+4lAUbMXYBIKf7aXOFXGQ g7H5kxl+IGB3T1c9XBkrJavX4ZUp/26PvgaPCDTzGZSJcBuEK/ZNyz3a9jfV+k2fpUIk UhY9/Z1rO1ko2MckFZZ7OKLU4CjuxTfeTXC2Wh7CqnakDmHrijAZ5UtyzjqjW2XgYSTK 92ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893890; x=1702498690; 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=8htIAC9kRG6RYa6OvogGIifB3FzQt1zgdxaJBwAA+IQ=; b=phVdHL4ojC1fnEMK3VefvUj2JXnew9YZu8DYnf/QxmGUSXGoW4cuex6YGHtbQaXM/s 6fHhY3XELIfHsGQi2INtB53Dwwu1y6WdpV0X8Cr7TOade5PXNUSpUY/CbzO7dUzD/jzR LlDbBT+DGEu8q60nGtESd4/XhfT56IATYsROfVYT4rrw7G4iKRsj0dRWl49Jl2ZG93bg 3czBNl1Im35f8gxaQzDv9TcsUdXJbigOrDXcTgjsvzPW/sC6LFGjQO2MQEUEGNxf9jci 1umNnXzWYAEntLJn0IaTlFz9cGEAi8HbG3kGnjf4hUWLlOuikD9tRwnmgzVw/RtItRjp KT8A== X-Gm-Message-State: AOJu0YzZox+2XJtB4OCysILoaA8iSEYARbdPjlgIoLp8pGgTIeWyZZH7 yYK3Jjy8vyMuPHPpGET6RoxHwJxu3kh0IQ== X-Google-Smtp-Source: AGHT+IGk5rkDCHmqcigyePXQQVpmVMm9zgr8aeyVjZUzK62TUz9Hr4KRw5YAu1t/HpwuSjwrTuNUIg== X-Received: by 2002:a17:902:e9c5:b0:1d0:ced9:3093 with SMTP id 5-20020a170902e9c500b001d0ced93093mr1515538plk.81.1701893890024; Wed, 06 Dec 2023 12:18:10 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:09 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 06/13] unit: use authenticator_fte Date: Wed, 6 Dec 2023 12:17:55 -0800 Message-Id: <20231206201802.2139649-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- unit/test-eapol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit/test-eapol.c b/unit/test-eapol.c index 563541f5..5317f9ad 100644 --- a/unit/test-eapol.c +++ b/unit/test-eapol.c @@ -3493,7 +3493,7 @@ static void eapol_ft_handshake_test(const void *data) handshake_state_set_supplicant_ie(hs, own_rsne); handshake_state_set_authenticator_ie(hs, ap_rsne); handshake_state_set_mde(hs, mde); - handshake_state_set_fte(hs, fte); + handshake_state_set_authenticator_fte(hs, fte); handshake_state_set_kh_ids(hs, r0khid, strlen((void *) r0khid), r1khid); eapol_start(sm); From patchwork Wed Dec 6 20:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482229 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 C006048CFA for ; Wed, 6 Dec 2023 20:18:11 +0000 (UTC) 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="TU2n8Jyt" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6ce6b62746dso215009b3a.2 for ; Wed, 06 Dec 2023 12:18:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893891; x=1702498691; 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=8DzlhUMXwricrd/pzBGQ6SKtzknJFadlM6DGba9y6jE=; b=TU2n8JytPDFoOHZJpD+BoHEQkUDcbWFULcg3QSdckwL/mwJmHGWy6DdC2RYjFuORzo 68YYf6QFFFfo34W1Sjtuzca0awUzNMJFNoCwUEqp560GlNeSe7H+jwOJ19wNzx6j4Low LkmtZEK4PrXh49fibYxCOjQgbGohBchzavQbvt5nalsyyzcMIkOWvBl2198IJUjyUjIx NLyEaSegEkzdQM5gLI4VLzC0p4Q+KR3fUYAO0NGwcug3EJjURMWZJxpavbcw68HLxM4c 6Z/I5yDF0hvhMr4t33S5THUxFDfe4t8cDuYt8sPljG7JVFSDIjDEG3KMinF++w7LaBWH 84wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893891; x=1702498691; 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=8DzlhUMXwricrd/pzBGQ6SKtzknJFadlM6DGba9y6jE=; b=dO3z1HJmG4fUwIEUCJqmAHDEo4KqZ1FpbHAN+oofsPOs3K7U4p+Pgg1GbROIcR7UML apb3dBUiPdCE5N1roAO7fxHUNcO1vnVkymzLWCNoIjlmRTGYJePk7mwmrAVGXGikoFz9 IpA5iAmvnFKVj48MesE+oa7vz5CivvsqYBIN8rAoP1/WmA2sZDh51zOWr1D/uDtXRMoZ jAtuNh3ABDUlFg98toeZfOsXIEGtGMaC5JG26KuKbA2DDgGWQqr9ootJeg1JOc/rR9vA dtylNRd7o2dU6uIPcD0011PZLVOBXzO+wLyZRmKX4zL1X+EqKoHoke1ECgeKWuqLiJti sB+w== X-Gm-Message-State: AOJu0YxTeFu970b2eu9XOrT9+IA0rrnxbiXmSa+h+PTOpmHs53tCWvB0 mPfJJ1Rdpx9iU02pieTClXTMrnX0Nsiu8Q== X-Google-Smtp-Source: AGHT+IG2ZxD3lu4IMNExsU1JnY+30fvn0oLbWuSs8xU/DMgI/Q1HnOURKByggHisMb6Kv5CJiFruyQ== X-Received: by 2002:a05:6a00:f90:b0:6ce:38d4:273e with SMTP id ct16-20020a056a000f9000b006ce38d4273emr1298304pfb.58.1701893890863; Wed, 06 Dec 2023 12:18:10 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:10 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 07/13] handshake: remove handshake_state_set_fte Date: Wed, 6 Dec 2023 12:17:56 -0800 Message-Id: <20231206201802.2139649-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replaced by set_authenticator_fte --- src/handshake.c | 6 ------ src/handshake.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/handshake.c b/src/handshake.c index ad8533f4..8fab4498 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -122,7 +122,6 @@ void handshake_state_free(struct handshake_state *s) l_free(s->authenticator_rsnxe); l_free(s->supplicant_rsnxe); l_free(s->mde); - l_free(s->fte); l_free(s->authenticator_fte); l_free(s->supplicant_fte); l_free(s->fils_ip_req_ie); @@ -310,11 +309,6 @@ void handshake_state_set_mde(struct handshake_state *s, const uint8_t *mde) replace_ie(&s->mde, mde); } -void handshake_state_set_fte(struct handshake_state *s, const uint8_t *fte) -{ - replace_ie(&s->fte, fte); -} - void handshake_state_set_authenticator_fte(struct handshake_state *s, const uint8_t *fte) { diff --git a/src/handshake.h b/src/handshake.h index e6344048..562e44ce 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -103,7 +103,6 @@ struct handshake_state { uint8_t *authenticator_rsnxe; uint8_t *supplicant_rsnxe; uint8_t *mde; - uint8_t *fte; uint8_t *authenticator_fte; uint8_t *supplicant_fte; uint8_t *vendor_ies; @@ -216,7 +215,6 @@ void handshake_state_set_ssid(struct handshake_state *s, const uint8_t *ssid, size_t ssid_len); void handshake_state_set_mde(struct handshake_state *s, const uint8_t *mde); -void handshake_state_set_fte(struct handshake_state *s, const uint8_t *fte); void handshake_state_set_authenticator_fte(struct handshake_state *s, const uint8_t *fte); void handshake_state_set_supplicant_fte(struct handshake_state *s, From patchwork Wed Dec 6 20:17:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482231 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 5BA5D6EB72 for ; Wed, 6 Dec 2023 20:18:12 +0000 (UTC) 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="NyhoGaPj" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-5c673b01eeeso116980a12.1 for ; Wed, 06 Dec 2023 12:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893891; x=1702498691; 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=uxevXmoqhhI+4l2MBFxPbJOmSHW4RYnLU/7XtVoHaTE=; b=NyhoGaPjy7JttIhTZgRAbcvBtPw2lLx6WS5tIM4hnwAjXeo8FsGrkLl/enNgGv+tIc L9KWwrSe+oCDtdRsRTzPs6T6U1feXuTdDr7JxbrY2sCDkcm5tVZeUVAu63YJvN+hDWYV U2punW7yAcMfRvjOfYPmOp7vtwAl9tBtefWLbJNYK0nHx2cKdeyn70tINu+N7WJN9E4R eYDZpRZC2yXL7t7Cd+6/+lKnU/qW/ThG59R9KIpRvtDuNQOsjLCVGCpPkSGCkp+LgtXy pVjP2B3w4jBOGYlqZMOJWzMeRhJ4QKvoNgh/8pvYSHZ0v0ZUw9G9b9FEtveLPeGJ1pUY 0nUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893891; x=1702498691; 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=uxevXmoqhhI+4l2MBFxPbJOmSHW4RYnLU/7XtVoHaTE=; b=WyL6EnF4mmtHDCU/+Nl7Cs6PpNJxqe/dNnmMw7Tuw1KZyqguVppDoN3L1cpR1R+/Ci at9A8qFxwwBs5n73bT3cDCnut/hwK3FGI/gKVd2m9/0UuiAAB54bDKUZwygjPPNyh5bl aEegNIuH2RNwqtuvHxkj4G0rdpFxBujzXbDnMpONS7qDc6XLHxc5vKZRcZiodlRlalSa dzHD1D3aLonf8YAk7/zCRUCSX+XL8Kv/DXRReNrNi/K9oEul+gErejDFROURwGCsaSQq uMAbV94Vx6Tm1epc87ZIlY2ANTbmJXETZvEkZFelz1LTiu56iJTBA/KKTdtVkMgb9ds6 MMvg== X-Gm-Message-State: AOJu0Yyo9J1Ovz4BoJnQggjMJFy+rl3TaxyiYIzoMSRb5cl0I8mn1Mmh WkBjDJ3pfZzlq+LqVHvi2inohhsarHaV8g== X-Google-Smtp-Source: AGHT+IGgrMxyxsEk67QTx2nItbs0NWXrUnsfReyOh7PZQJL0OVkhejStkkvSzcTGzUF2bWGdzL379w== X-Received: by 2002:a05:6a20:428e:b0:18a:181b:1439 with SMTP id o14-20020a056a20428e00b0018a181b1439mr1568602pzj.6.1701893891321; Wed, 06 Dec 2023 12:18:11 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:11 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 08/13] ft: add FTE/RSNE building to ft_prepare_handshake Date: Wed, 6 Dec 2023 12:17:57 -0800 Message-Id: <20231206201802.2139649-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In preparation to remove ft_associate build the FTE/RSNE in ft_prepare_handshake and set into the handshake object directly. --- src/ft.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/src/ft.c b/src/ft.c index 43399828..d3b9234a 100644 --- a/src/ft.c +++ b/src/ft.c @@ -904,9 +904,15 @@ static void ft_info_destroy(void *data) l_free(info); } -static void ft_prepare_handshake(struct ft_info *info, +static bool ft_prepare_handshake(struct ft_info *info, struct handshake_state *hs) { + uint32_t kck_len = handshake_state_get_kck_len(hs); + struct ie_rsn_info rsn_info; + struct ie_ft_info ft_info; + uint8_t *fte; + uint8_t *rsne; + handshake_state_set_authenticator_address(hs, info->aa); memcpy(hs->mde + 2, info->mde, 3); @@ -914,7 +920,7 @@ static void ft_prepare_handshake(struct ft_info *info, handshake_state_set_chandef(hs, NULL); if (!hs->supplicant_ie) - return; + return true; if (info->authenticator_ie) handshake_state_set_authenticator_ie(hs, @@ -931,6 +937,80 @@ static void ft_prepare_handshake(struct ft_info *info, info->ft_info.r1khid); handshake_state_derive_ptk(hs); + + /* + * Rebuild the RSNE to include the PMKR1Name and append + * MDE + FTE. + * + * 12.8.4: "If present, the RSNE shall be set as follows: + * - Version field shall be set to 1. + * - PMKID Count field shall be set to 1. + * - PMKID field shall contain the PMKR1Name. + * - All other fields shall be as specified in 8.4.2.27 + * and 11.5.3." + */ + if (ie_parse_rsne_from_data(hs->supplicant_ie, + hs->supplicant_ie[1] + 2, + &rsn_info) < 0) + return false; + + rsn_info.num_pmkids = 1; + rsn_info.pmkids = hs->pmk_r1_name; + /* Always set OCVC false for FT for now */ + rsn_info.ocvc = false; + rsne = alloca(256); + + ie_build_rsne(&rsn_info, rsne); + handshake_state_set_supplicant_ie(hs, rsne); + + /* + * 12.8.4: "If present, the FTE shall be set as follows: + * - ANonce, SNonce, R0KH-ID, and R1KH-ID shall be set to + * the values contained in the second message of this + * sequence. + * - The Element Count field of the MIC Control field shall + * be set to the number of elements protected in this + * frame (variable). + * [...] + * - All other fields shall be set to 0." + */ + memset(&ft_info, 0, sizeof(ft_info)); + ft_info.mic_element_count = 3; + memcpy(ft_info.r0khid, hs->r0khid, hs->r0khid_len); + ft_info.r0khid_len = hs->r0khid_len; + memcpy(ft_info.r1khid, hs->r1khid, 6); + ft_info.r1khid_present = true; + memcpy(ft_info.anonce, hs->anonce, 32); + memcpy(ft_info.snonce, hs->snonce, 32); + + /* + * IEEE 802.11-2020 Section 13.7.1 FT reassociation in an RSN + * + * "If dot11RSNAOperatingChannelValidationActivated is true and + * the FTO indicates OCVC capability, the target AP shall + * ensure that OCI subelement of the FTE matches by ensuring + * that all of the following are true: + * - OCI subelement is present + * - Channel information in the OCI matches current + * operating channel parameters (see 12.2.9)" + */ + if (hs->supplicant_ocvc && hs->chandef) { + oci_from_chandef(hs->chandef, ft_info.oci); + ft_info.oci_present = true; + } + + fte = alloca(256); + ie_build_fast_bss_transition(&ft_info, kck_len, fte); + + if (!ft_calculate_fte_mic(hs, 5, rsne, fte, NULL, ft_info.mic)) + return false; + + /* Rebuild the FT IE now with the MIC included */ + ie_build_fast_bss_transition(&ft_info, kck_len, fte); + + handshake_state_set_supplicant_fte(hs, fte); + + return true; } static bool ft_send_action(struct wiphy_radio_work_item *work) From patchwork Wed Dec 6 20:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482232 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 F0DF06F604 for ; Wed, 6 Dec 2023 20:18:12 +0000 (UTC) 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="Q0x0oEEK" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d048c171d6so1453085ad.1 for ; Wed, 06 Dec 2023 12:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893892; x=1702498692; 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=RyQGXto/GxzHzfAsGHjVXz/14qfSbn0f8ejMzfWWMqs=; b=Q0x0oEEKaPnGu2QtDNQjXLNyz6TT3UWIVwXQ8AbAbQIWpdbWfGUNqptYj44Nb2bEhf wioT6P8dBWBqqsHVRUixWa5/4Nvw4feq7WClE+oNP6WHT8NiGjyEamu5o4MO1pgQNj/m KQcJNqZGbSf9xEpUf9Ei62boK6NhwGx6tMKlRqg3cllk5begpOLwWUAWCkvHE3umUCj6 Boeo1UJOBI/fdC45Y/qLA1gTpRq/DvCRkR5804SKwe433Ibc0GrFwPTwUHQ4c+lx0ZMK CnFPXZg3hDe1vJRHsS4o/SThbYpat40YLrTAW6/a7nRvZsR229LYUncqIbRhCRMSWhQJ Enow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893892; x=1702498692; 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=RyQGXto/GxzHzfAsGHjVXz/14qfSbn0f8ejMzfWWMqs=; b=WDPBwjcWrvZZuL82VJvyvDhVyRWZlGnrqZcBNU7VJuCc48K4gsLF2Ab4VWPQWdaMIq 4eZawgycoSVr+J/z/+ch9JbX/hBlY8UMBp+XZQbQGIlsZkfm2vQVLCbe5n8xNcfiKIdB 6QPyHvI953uwDDUMOWZg+AaZUGZvE+vFw1Eg2SZsg9ADya6tBW7RVgf7X4g3QrN0e1Nw 6108FZnynqxttzhNQJoSkmIdZRnMtCnRpuVmQoNTXulF9DtH+80zCePXh+5PENcvMscd TuH29fruxtGW4dN6wtYlKKdUjEHLL2gVNhE6mFqIJ1FuMj3xJHpM/iviK6D9WopeKr00 ZK3A== X-Gm-Message-State: AOJu0YwmHIrQP9C30GXrJFzrus6VaUdnp1sCReaow+qIQIFhDQYDZOOT pi7GNM1LnjdILGTXYIp4aJTC+fJS07LOZg== X-Google-Smtp-Source: AGHT+IGNme2hqmsGmSEUA9ayod4/Y7pU4T52Blx7CeJ2c1z9/ayBSYw3ZOKwsfj6dsRMSMoLeNhpIg== X-Received: by 2002:a17:903:483:b0:1d0:60cc:7ebb with SMTP id jj3-20020a170903048300b001d060cc7ebbmr1405718plb.25.1701893891971; Wed, 06 Dec 2023 12:18:11 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:11 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 09/13] ft: add ft_handshake_setup Date: Wed, 6 Dec 2023 12:17:58 -0800 Message-Id: <20231206201802.2139649-9-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will be called from station after FT-authentication has finished. It sets up the handshake object to perform reassociation. This is essentially a copy-paste of ft_associate without sending the actual frame. --- src/ft.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/ft.h | 2 ++ 2 files changed, 42 insertions(+) diff --git a/src/ft.c b/src/ft.c index d3b9234a..c612a433 100644 --- a/src/ft.c +++ b/src/ft.c @@ -1276,6 +1276,46 @@ int ft_associate(uint32_t ifindex, const uint8_t *addr) return ret; } +int ft_handshake_setup(uint32_t ifindex, const uint8_t *target) +{ + struct netdev *netdev = netdev_find(ifindex); + struct handshake_state *hs = netdev_get_handshake(netdev); + struct ft_info *info; + int ret = 0; + + info = ft_info_find(ifindex, target); + if (!info) + return -ENOENT; + + /* + * Either failed or no response. This may have been an FT-over-DS + * attempt so clear out the entry so FT-over-Air can try again. + */ + if (info->status != 0) { + int status = info->status; + + l_queue_remove(info_list, info); + ft_info_destroy(info); + + return status; + } + + /* + * This shouldn't ever fail: + * - supplicant_ie has already been validated long ago + * - l_checksum_* shouldn't fail since we presumable have kernel + * support, how else could we have made it this far. + * But just in case... + */ + if (L_WARN_ON(!ft_prepare_handshake(info, hs))) + ret = -EINVAL; + + /* After this no previous auths will be valid */ + ft_clear_authentications(ifindex); + + return ret; +} + static bool remove_ifindex(void *data, void *user_data) { struct ft_info *info = data; diff --git a/src/ft.h b/src/ft.h index 51bbe3bc..23d0136e 100644 --- a/src/ft.h +++ b/src/ft.h @@ -39,6 +39,8 @@ void __ft_rx_action(uint32_t ifindex, const uint8_t *frame, size_t frame_len); void __ft_rx_authenticate(uint32_t ifindex, const uint8_t *frame, size_t frame_len); +int ft_handshake_setup(uint32_t ifindex, const uint8_t *target); + void ft_clear_authentications(uint32_t ifindex); int ft_action(uint32_t ifindex, uint32_t freq, const struct scan_bss *target); int ft_associate(uint32_t ifindex, const uint8_t *addr); From patchwork Wed Dec 6 20:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482233 Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 59E836F61F for ; Wed, 6 Dec 2023 20:18:13 +0000 (UTC) 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="CIW+8r0I" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d0c94397c0so1253345ad.2 for ; Wed, 06 Dec 2023 12:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893892; x=1702498692; 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=N8ajSUum+U4KJg54/Nve5xodtgkJ4Z3hifVFPGvmfaM=; b=CIW+8r0IgC3+uJ+VZDxtWkWSN6LQrtM8kXxib0lOlCE0Xu4LWvJkIwLDWn6nrYcekx Qpv0+8/YGvPJlUckzThzV5JZ9rnx6Le/11XNfNgJVuPYjP8uFB7XDEqkgDmqQaGzPWn2 S87RLHkxkHL/KqgrODJrZfrILiAm1GPtIthMyoj3NkqLFqplO7N9fCHYu2fB/OLwPDgO 1KOjFjCyPthMkkpFFJx5i/8WkcDXAXYTGs+uOXWZH6g9VcIixaSiCZfTi/TrvgBQhWIq GV3Oe9sBu57NzWav2MPMAfIhFZuRLDGzWjwOKTfeQaphmulF8v8rsHeN0vC64qnraDcC 15QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893892; x=1702498692; 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=N8ajSUum+U4KJg54/Nve5xodtgkJ4Z3hifVFPGvmfaM=; b=f43Q4z3N24tA9ugZsAzIYkiRpUBd5GBqAi0HzWKhJgaeTnxVb7YMDSX+K/zVdzwM9i EZI+IhC3c1LQv7qgt+cgwZG4Bd8lH4nNuzc4ZeiHX6lxwxw3ynIbLtPQ1qfWCXM8jPts lTTd1nYZ3a6l4o/ox6D7VHB0fkcwVabvna3BRptgeK+ljvLMLNVMTJL9CYs/dnkabDnl HHqCQcPapx2scyqP9kRaEaj8jay9RKu7S+Da9i2vn7XWvf2pEJ9ILrhjv1uSeHQ8wfEA +y0e+tuhD8g7Z2VnHx9idBtzu/YWbdl2BTrc92yW2lxtKsIA436YpF4bwfN+nkMmfjDt PrHw== X-Gm-Message-State: AOJu0YwK0MbDMI20DdPw1Wy44bp1f/wpcliqhbhjYEeKuYQlFk+QTBUP NUKvvdokYXSWYnBHFdfpXRxD6FJKVeQrzA== X-Google-Smtp-Source: AGHT+IHO25WLCOPkudPcvChAt+JUiMSr41SYbmGel6D9gB38DesTHIDEBuJa8KP3JoJZSxsSFCifZw== X-Received: by 2002:a17:902:c94b:b0:1d0:6ffd:ae11 with SMTP id i11-20020a170902c94b00b001d06ffdae11mr1687058pla.120.1701893892455; Wed, 06 Dec 2023 12:18:12 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:12 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 10/13] netdev: add netdev_ft_reassociate Date: Wed, 6 Dec 2023 12:17:59 -0800 Message-Id: <20231206201802.2139649-10-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Essentially exposes (and renames) netdev_ft_tx_associate in order to be called similarly to netdev_reassociate/netdev_connect where a connect callback can be provided. This will fix the current bug where if association times out during FT IWD will hang and never transition to disconnected. This also removes the calling of the FT_ROAMED event and instead just calls the connect callback (since its now set). This unifies the callback path for reassociation and FT roaming. --- src/netdev.c | 43 +++++++++++++++++++++++++------------------ src/netdev.h | 5 +++++ 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index b9dc930e..522baf7a 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -1409,16 +1409,13 @@ static void netdev_connect_ok(struct netdev *netdev) scan_bss_free(netdev->fw_roam_bss); netdev->fw_roam_bss = NULL; - } else if (netdev->in_ft) { - if (netdev->event_filter) - netdev->event_filter(netdev, NETDEV_EVENT_FT_ROAMED, - NULL, netdev->user_data); - netdev->in_ft = false; } else if (netdev->connect_cb) { netdev->connect_cb(netdev, NETDEV_RESULT_OK, NULL, netdev->user_data); netdev->connect_cb = NULL; - } + netdev->in_ft = false; + } else + l_warn("Connection event without a connect callback!"); netdev_rssi_polling_update(netdev); @@ -4205,13 +4202,14 @@ static int netdev_tx_ft_frame(uint32_t ifindex, uint16_t frame_type, return 0; } -static int netdev_ft_tx_associate(uint32_t ifindex, uint32_t freq, - const uint8_t *prev_bssid, - struct iovec *ft_iov, size_t n_ft_iov) +int netdev_ft_reassociate(struct netdev *netdev, + const struct scan_bss *target_bss, + const struct scan_bss *orig_bss, + netdev_event_func_t event_filter, + netdev_connect_cb_t cb, void *user_data) { - struct netdev *netdev = netdev_find(ifindex); - struct netdev_handshake_state *nhs; struct handshake_state *hs = netdev->handshake; + struct netdev_handshake_state *nhs; struct l_genl_msg *msg; struct iovec iov[64]; unsigned int n_iov = L_ARRAY_SIZE(iov); @@ -4223,11 +4221,14 @@ static int netdev_ft_tx_associate(uint32_t ifindex, uint32_t freq, * At this point there is no going back with FT so reset all the flags * needed to associate with a new BSS. */ - netdev->frequency = freq; + netdev->frequency = target_bss->frequency; netdev->handshake->active_tk_index = 0; netdev->associated = false; netdev->operational = false; netdev->in_ft = true; + netdev->event_filter = event_filter; + netdev->connect_cb = cb; + netdev->user_data = user_data; /* * Cancel commands that could be running because of EAPoL activity @@ -4271,15 +4272,22 @@ static int netdev_ft_tx_associate(uint32_t ifindex, uint32_t freq, c_iov = netdev_populate_common_ies(netdev, hs, msg, iov, n_iov, c_iov); - if (!L_WARN_ON(n_iov - c_iov < n_ft_iov)) { - memcpy(iov + c_iov, ft_iov, sizeof(*ft_iov) * n_ft_iov); - c_iov += n_ft_iov; - } + if (hs->supplicant_ie) + c_iov = iov_ie_append(iov, n_iov, c_iov, hs->supplicant_ie, + IE_LEN(hs->supplicant_ie)); + + if (hs->supplicant_fte) + c_iov = iov_ie_append(iov, n_iov, c_iov, hs->supplicant_fte, + IE_LEN(hs->supplicant_fte)); + + if (hs->mde) + c_iov = iov_ie_append(iov, n_iov, c_iov, hs->mde, + IE_LEN(hs->mde)); mpdu_sort_ies(subtype, iov, c_iov); l_genl_msg_append_attr(msg, NL80211_ATTR_PREV_BSSID, ETH_ALEN, - prev_bssid); + orig_bss->addr); l_genl_msg_append_attrv(msg, NL80211_ATTR_IE, iov, c_iov); netdev->connect_cmd_id = l_genl_family_send(nl80211, msg, @@ -6256,7 +6264,6 @@ static int netdev_init(void) __eapol_set_install_pmk_func(netdev_set_pmk); __ft_set_tx_frame_func(netdev_tx_ft_frame); - __ft_set_tx_associate_func(netdev_ft_tx_associate); unicast_watch = l_genl_add_unicast_watch(genl, NL80211_GENL_NAME, netdev_unicast_notify, diff --git a/src/netdev.h b/src/netdev.h index 03d1b6e9..fb31b571 100644 --- a/src/netdev.h +++ b/src/netdev.h @@ -165,6 +165,11 @@ int netdev_reassociate(struct netdev *netdev, struct handshake_state *hs, netdev_event_func_t event_filter, netdev_connect_cb_t cb, void *user_data); +int netdev_ft_reassociate(struct netdev *netdev, + const struct scan_bss *target_bss, + const struct scan_bss *orig_bss, + netdev_event_func_t event_filter, + netdev_connect_cb_t cb, void *user_data); int netdev_preauthenticate(struct netdev *netdev, const struct scan_bss *target_bss, From patchwork Wed Dec 6 20:18:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482234 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 E6EAF6F627 for ; Wed, 6 Dec 2023 20:18:13 +0000 (UTC) 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="cRMZ71M3" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1d048c171d6so1453155ad.1 for ; Wed, 06 Dec 2023 12:18:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893893; x=1702498693; 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=TJARLQL5FvzCcPOG6EstqAKI+K/ZnM3CWBfY634KnYg=; b=cRMZ71M3FFJ8zvQqXNoBKXvsO7XHGfg4bR7iJbGlOrafHaxEWc/HGio9kOVeDroyTS r+vxod6homN+rnfGAItS6HsYopDumNnNBYfhbXHTmb99u6CEG21YxbDFRdI9EDnSPDJJ SmFuTcEjPrhfiXqOPTWMgz0TI3rIp8asf6rCOabgTcmfKpMS2XWMKXIiTpd62IM3V1AZ 0eh/x3mwuqz6IVqur2L2N6IJxa0jpSqupMPxUxwLILHHVlF/aSogHIVIEFOYLUjEMApr Wwpm93iFwZFa/0cami5JAxnFPX0VIha9q2of/7nXIGVqms9kdMMf0jopHXHUV8a9uE6s mBZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893893; x=1702498693; 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=TJARLQL5FvzCcPOG6EstqAKI+K/ZnM3CWBfY634KnYg=; b=Bw0KdbhycKHS5xC5wzTozC8J3EQKPrOz+UjmpxzL14OtJdTOGCaKEUA1Bbi2iajQx0 l6WVMqw/BTBWWkav2nCikeYUgYZ4aEmYl697+H68bHKtIdI4w7tiGr+6EhX+G7OzYqC4 9oDzLFqaeXzD72ybx2VhwQGNBlh29S8RSkIVCOmihxmASWHX8ooGKPW2UK3fULLBMIWs aVPLs/pK9GC1hOkP9bhqUKJSgU56cKntqkXPjtGGolNvpsVO4igIkJdVPmdPOoe9lB56 x8FVwtr4DGdhfrpveJizjYZQFRVQ9NJG75Ojjxx8Bob2BYmyhv9iRtSmKE58HjcBo4OI z9KA== X-Gm-Message-State: AOJu0Yxcv8e6aB35khQgABUlhtaWGh+782ds26alN6FRB9oU4lSSo8Fn aisFGPP2udTrDCDcT7YKkKcc8/vbJAo4fw== X-Google-Smtp-Source: AGHT+IEjBEJk7pbCau2L7VejYayce3AixREfWQL6kLNfx1S0fetUYLB6VPw+YHHgEFe4DoT/Kgdk4Q== X-Received: by 2002:a17:902:f546:b0:1d0:c445:8014 with SMTP id h6-20020a170902f54600b001d0c4458014mr1760273plf.76.1701893892980; Wed, 06 Dec 2023 12:18:12 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:12 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 11/13] station: use netdev_ft_reassociate Date: Wed, 6 Dec 2023 12:18:00 -0800 Message-Id: <20231206201802.2139649-11-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Using this will provide netdev with a connect callback and unify the roaming result notification between FT and reassociation. Both paths will now end up in station_reassociate_cb. This also adds another return case for ft_handshake_setup which was previously ignored by ft_associate. Its likely impossible to actually happen but should be handled nevertheless. Fixes: 30c6a10f28 ("netdev: Separate connect_failed and disconnected paths") --- src/station.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/station.c b/src/station.c index 48a595dc..52d87c84 100644 --- a/src/station.c +++ b/src/station.c @@ -2181,7 +2181,8 @@ static void station_reassociate_cb(struct netdev *netdev, l_debug("%u, result: %d", netdev_get_ifindex(station->netdev), result); - if (station->state != STATION_STATE_ROAMING) + if (station->state != STATION_STATE_ROAMING && + station->state != STATION_STATE_FT_ROAMING) return; if (result == NETDEV_RESULT_OK) @@ -2314,7 +2315,8 @@ static bool station_ft_work_ready(struct wiphy_radio_work_item *item) if (!bss) goto try_next; - ret = ft_associate(netdev_get_ifindex(station->netdev), bss->addr); + ret = ft_handshake_setup(netdev_get_ifindex(station->netdev), + bss->addr); switch (ret) { case MMPDU_STATUS_CODE_INVALID_PMKID: /* @@ -2343,12 +2345,28 @@ try_next: station_transition_start(station); break; case 0: + ret = netdev_ft_reassociate(station->netdev, bss, + station->connected_bss, + station_netdev_event, + station_reassociate_cb, station); + if (ret < 0) + goto disassociate; + station->connected_bss = bss; station->preparing_roam = false; station_enter_state(station, STATION_STATE_FT_ROAMING); station_debug_event(station, "ft-roam"); + break; + case -EINVAL: + /* + * Likely an impossible situation, but since ft_handshake_setup + * rederived the handshake keys we can't do anything but + * disconnect. + */ +disassociate: + station_disassociated(station); break; default: if (ret > 0) From patchwork Wed Dec 6 20:18:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482235 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 B4B0C6EB72 for ; Wed, 6 Dec 2023 20:18:14 +0000 (UTC) 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="EpmJM89h" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1d04c097e34so1794875ad.0 for ; Wed, 06 Dec 2023 12:18:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893894; x=1702498694; 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=IMRJ21BvtcbcgEK0KkDWtNJ899I+7BxdrJXqZMjxwTs=; b=EpmJM89hxD1RiLDkMX66/DIgn3Ze2F2rrerr/QiIsArnIl+fUiuX6q5K++O5QtuHT5 MFlUrtHjVZcaLLD/ofhp4r4rPYjCTM2D5Eu2j8aWVGAPSZzK3BCGexqERplalrXs2VbG Q3CbSXFWGjTjCZE/VvsEHc4/1JwAxPI7y4C1qC22LpvKDITlp0qxZ6WjoJ2SAatJHdak i9vVXAlNnbcmCbIT6yf6ShSUxwvqcaDvklaOw0zSqqERSIyPb+IK8ImOeFMM5nG48dwj 0gZdKJywXX4QLMObJ1Z2wP/RVNQvyJa/TV1GJ5gm4eqPeEOesa+c/SOJeHLwv378KzPO Yh9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893894; x=1702498694; 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=IMRJ21BvtcbcgEK0KkDWtNJ899I+7BxdrJXqZMjxwTs=; b=VMsoe0CLBDpEp3qWDAiAHmrsP0RUyY9UX2ItHJPYf17I3vdIZxoFCUhnd7yfGkkJZs Ra3TVCVJd97jub0ieu9fUhNDUA7l87vQBc3vDu5Pz1zUtruKIBJF/Xyy205Eg/fv4f4F wkVJRCi8UmA3SezAJ0j7uqRZ+sEzGRZDPmpXv18d3hFuB1BG6uB2F3zDviuwekyDUBxK Iekv28wTd41eF2vmq/MGmgzZli3vBDqWqUb4riRlVX7e/iqdY9k7oRxkTgiD9+mppN63 aU2A67eRmfXuRhZGQWSFY18VdzmyZMnXuFfkGmuQr/Zt49LzZL+wbCufYMyY3iQcvNGL sBxA== X-Gm-Message-State: AOJu0YyCMpBb43mNjJkZqxgJVbJUGd0pLQOGpTj2p96VTXW8oQfgX6mW u6mcB8k0PU/nNKXd8qHZk43xdl49vhXNyQ== X-Google-Smtp-Source: AGHT+IGMXnxCxVQk6ghUxbxd5Yhd0PDKNTjwlnlIguruxUlzyFP52W0fQg6jTtnW8reA3mVW4l/C7g== X-Received: by 2002:a17:902:ee05:b0:1d0:68a:4a12 with SMTP id z5-20020a170902ee0500b001d0068a4a12mr4174102plb.15.1701893893782; Wed, 06 Dec 2023 12:18:13 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:13 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 12/13] ft: remove ft_associate and helpers Date: Wed, 6 Dec 2023 12:18:01 -0800 Message-Id: <20231206201802.2139649-12-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The reassociation is done through netdev directly, these are no longer needed. --- src/ft.c | 160 +------------------------------------------------------ src/ft.h | 2 - 2 files changed, 1 insertion(+), 161 deletions(-) diff --git a/src/ft.c b/src/ft.c index c612a433..d8bee74c 100644 --- a/src/ft.c +++ b/src/ft.c @@ -43,7 +43,6 @@ static const unsigned int FT_ONCHANNEL_TIME = 300u; /* ms */ static ft_tx_frame_func_t tx_frame = NULL; -static ft_tx_associate_func_t tx_assoc = NULL; static struct l_queue *info_list = NULL; struct ft_info { @@ -224,117 +223,6 @@ static bool ft_parse_associate_resp_frame(const uint8_t *frame, size_t frame_len return true; } -static int ft_tx_reassociate(uint32_t ifindex, uint32_t freq, - const uint8_t *prev_bssid) -{ - struct netdev *netdev = netdev_find(ifindex); - struct handshake_state *hs = netdev_get_handshake(netdev); - struct iovec iov[3]; - int iov_elems = 0; - uint32_t kck_len = handshake_state_get_kck_len(hs); - bool is_rsn = hs->supplicant_ie != NULL; - uint8_t *rsne = NULL; - - if (is_rsn) { - struct ie_rsn_info rsn_info; - - /* - * Rebuild the RSNE to include the PMKR1Name and append - * MDE + FTE. - * - * 12.8.4: "If present, the RSNE shall be set as follows: - * - Version field shall be set to 1. - * - PMKID Count field shall be set to 1. - * - PMKID field shall contain the PMKR1Name. - * - All other fields shall be as specified in 8.4.2.27 - * and 11.5.3." - */ - if (ie_parse_rsne_from_data(hs->supplicant_ie, - hs->supplicant_ie[1] + 2, - &rsn_info) < 0) - goto error; - - rsn_info.num_pmkids = 1; - rsn_info.pmkids = hs->pmk_r1_name; - - /* Always set OCVC false for FT for now */ - rsn_info.ocvc = false; - - rsne = alloca(256); - ie_build_rsne(&rsn_info, rsne); - - iov[iov_elems].iov_base = rsne; - iov[iov_elems].iov_len = rsne[1] + 2; - iov_elems += 1; - } - - /* The MDE advertised by the BSS must be passed verbatim */ - iov[iov_elems].iov_base = (void *) hs->mde; - iov[iov_elems].iov_len = hs->mde[1] + 2; - iov_elems += 1; - - if (is_rsn) { - struct ie_ft_info ft_info; - uint8_t *fte; - - /* - * 12.8.4: "If present, the FTE shall be set as follows: - * - ANonce, SNonce, R0KH-ID, and R1KH-ID shall be set to - * the values contained in the second message of this - * sequence. - * - The Element Count field of the MIC Control field shall - * be set to the number of elements protected in this - * frame (variable). - * [...] - * - All other fields shall be set to 0." - */ - - memset(&ft_info, 0, sizeof(ft_info)); - - ft_info.mic_element_count = 3; - memcpy(ft_info.r0khid, hs->r0khid, hs->r0khid_len); - ft_info.r0khid_len = hs->r0khid_len; - memcpy(ft_info.r1khid, hs->r1khid, 6); - ft_info.r1khid_present = true; - memcpy(ft_info.anonce, hs->anonce, 32); - memcpy(ft_info.snonce, hs->snonce, 32); - - /* - * IEEE 802.11-2020 Section 13.7.1 FT reassociation in an RSN - * - * "If dot11RSNAOperatingChannelValidationActivated is true and - * the FTO indicates OCVC capability, the target AP shall - * ensure that OCI subelement of the FTE matches by ensuring - * that all of the following are true: - * - OCI subelement is present - * - Channel information in the OCI matches current - * operating channel parameters (see 12.2.9)" - */ - if (hs->supplicant_ocvc && hs->chandef) { - oci_from_chandef(hs->chandef, ft_info.oci); - ft_info.oci_present = true; - } - - fte = alloca(256); - ie_build_fast_bss_transition(&ft_info, kck_len, fte); - - if (!ft_calculate_fte_mic(hs, 5, rsne, fte, NULL, ft_info.mic)) - goto error; - - /* Rebuild the FT IE now with the MIC included */ - ie_build_fast_bss_transition(&ft_info, kck_len, fte); - - iov[iov_elems].iov_base = fte; - iov[iov_elems].iov_len = fte[1] + 2; - iov_elems += 1; - } - - return tx_assoc(ifindex, freq, prev_bssid, iov, iov_elems); - -error: - return -EINVAL; -} - static bool ft_verify_rsne(const uint8_t *rsne, const uint8_t *pmk_r0_name, const uint8_t *authenticator_ie) { @@ -762,11 +650,6 @@ void __ft_set_tx_frame_func(ft_tx_frame_func_t func) tx_frame = func; } -void __ft_set_tx_associate_func(ft_tx_associate_func_t func) -{ - tx_assoc = func; -} - static bool ft_parse_ies(struct ft_info *info, struct handshake_state *hs, const uint8_t *ies, size_t ies_len) { @@ -1173,7 +1056,7 @@ static void ft_authenticate_destroy(int error, void *user_data) /* * There is no callback here because its assumed that another work item will * be inserted following this call which will check if authentication succeeded - * via ft_associate. + * via ft_handshake_setup. * * If the netdev goes away while authentication is in-flight station will clear * the authentications during cleanup, and in turn cancel the offchannel @@ -1235,47 +1118,6 @@ int ft_authenticate_onchannel(uint32_t ifindex, const struct scan_bss *target) return 0; } -int ft_associate(uint32_t ifindex, const uint8_t *addr) -{ - struct netdev *netdev = netdev_find(ifindex); - struct handshake_state *hs = netdev_get_handshake(netdev); - struct ft_info *info; - int ret; - - /* - * TODO: Since FT-over-DS is done early, before the time of roaming, it - * may end up that a completely new BSS is the best candidate and - * we haven't yet authenticated. We could actually authenticate - * at this point, but for now just assume the caller will choose - * a different BSS. - */ - info = ft_info_find(ifindex, addr); - if (!info) - return -ENOENT; - - /* - * Either failed or no response. This may have been an FT-over-DS - * attempt so clear out the entry so FT-over-Air can try again. - */ - if (info->status != 0) { - int status = info->status; - - l_queue_remove(info_list, info); - ft_info_destroy(info); - - return status; - } - - ft_prepare_handshake(info, hs); - - ret = ft_tx_reassociate(ifindex, info->frequency, info->prev_bssid); - - /* After this no previous auths will be valid */ - ft_clear_authentications(ifindex); - - return ret; -} - int ft_handshake_setup(uint32_t ifindex, const uint8_t *target) { struct netdev *netdev = netdev_find(ifindex); diff --git a/src/ft.h b/src/ft.h index 23d0136e..92c207fb 100644 --- a/src/ft.h +++ b/src/ft.h @@ -32,7 +32,6 @@ typedef int (*ft_tx_associate_func_t)(uint32_t ifindex, uint32_t freq, struct iovec *ie_iov, size_t iov_len); void __ft_set_tx_frame_func(ft_tx_frame_func_t func); -void __ft_set_tx_associate_func(ft_tx_associate_func_t func); int __ft_rx_associate(uint32_t ifindex, const uint8_t *frame, size_t frame_len); void __ft_rx_action(uint32_t ifindex, const uint8_t *frame, size_t frame_len); @@ -43,6 +42,5 @@ int ft_handshake_setup(uint32_t ifindex, const uint8_t *target); void ft_clear_authentications(uint32_t ifindex); int ft_action(uint32_t ifindex, uint32_t freq, const struct scan_bss *target); -int ft_associate(uint32_t ifindex, const uint8_t *addr); int ft_authenticate(uint32_t ifindex, const struct scan_bss *target); int ft_authenticate_onchannel(uint32_t ifindex, const struct scan_bss *target); From patchwork Wed Dec 6 20:18:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13482236 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 9DCE36F631 for ; Wed, 6 Dec 2023 20:18:15 +0000 (UTC) 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="KkIm8NO/" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6ce33234fd7so213568b3a.0 for ; Wed, 06 Dec 2023 12:18:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701893895; x=1702498695; 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=9mxJF5StbFHgA8xLY14uDOHYGQjLyG4VM1xi5k1s7+c=; b=KkIm8NO/49i/xQPnflGowsBcj2PrMREgIGj195/jlS2B7JH3qqQWg863xMAtPoTn3T q36dmKehKpKFgZLyh0NlCgFwmaQogZRW/YSw2vOwWahstI17gpKqUjs6xEmGGvbMMQSX 6II+nLbyX6vX2YXP/F62SpsJlszWb84dbZ7wpaivFAy6YFhSdMSImf2bkjuU41qirUcK nplyyQnOo4tgKowummtnH7Gt+9/JI3Nac3dqKD3QxBkpPZgF7ylU58SvOQNeVyWIWMdN IjKzdvB8/l89gJ2LHKLXhBsdW2/S2WJuSuKsg0CZ70KULE8qHyRgk4Ms7+AudOJdOull y+PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701893895; x=1702498695; 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=9mxJF5StbFHgA8xLY14uDOHYGQjLyG4VM1xi5k1s7+c=; b=hbBeYPL37prGTxCqZA3Ge9eiWP73cqlTx9bswo1KOoiAJLpgsyJF5816Wfnj3/0UDe L4upBBXpfE/V0QehCqfmxE3L+xfVrqgyVS95WNw0RiVvITp4V90RFrxfsMzCsqZcsaw+ ab1m1qJ3Q6l29pXPL4reoyz3wdLmZcJCCOa6CoJ/2T8Jdufoe5Vwcsxoa/o+XUKxsTVy 1CDoCWCWDTf8FV5sw+uaIkd0PYrKyoYfs7DiDdVTNCRqNjVO3Wo7lYLvdy4y3B5/Q7Fp xU9n2ONhSGZUrKBxVFawYx6yS+0uiLoCzkL9+XEqnq2HoLyTsLECugNSpMkbdwtTBFro N+Yg== X-Gm-Message-State: AOJu0YxWUUOUGbJVDWDsCJjwqZilNNmi7IpJuwTxlh+WLh2w4p234pPX auXPBBucNMZFROh9K5EyQ6TmjcW0CFeO6g== X-Google-Smtp-Source: AGHT+IEZSRP+Lokp6uvZoJH6qNarKQp7TOJruDN9PZ4GbrliKiSseBmlz3FTEA6rAHbZGCT9mUIQzQ== X-Received: by 2002:a05:6a00:2d25:b0:6cd:a145:6703 with SMTP id fa37-20020a056a002d2500b006cda1456703mr1208722pfb.2.1701893894699; Wed, 06 Dec 2023 12:18:14 -0800 (PST) Received: from LOCLAP699.. ([50.39.172.77]) by smtp.gmail.com with ESMTPSA id by40-20020a056a0205a800b005c2185be2basm243168pgb.54.2023.12.06.12.18.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 12:18:14 -0800 (PST) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH v3 13/13] netdev: station: remove NETDEV_EVENT_FT_ROAMED Date: Wed, 6 Dec 2023 12:18:02 -0800 Message-Id: <20231206201802.2139649-13-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206201802.2139649-1-prestwoj@gmail.com> References: <20231206201802.2139649-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The notification for roaming success/failure is now handled with the connect callback. --- src/netdev.h | 1 - src/station.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/src/netdev.h b/src/netdev.h index fb31b571..d87f09f4 100644 --- a/src/netdev.h +++ b/src/netdev.h @@ -50,7 +50,6 @@ enum netdev_event { NETDEV_EVENT_RSSI_THRESHOLD_HIGH, NETDEV_EVENT_RSSI_LEVEL_NOTIFY, NETDEV_EVENT_PACKET_LOSS_NOTIFY, - NETDEV_EVENT_FT_ROAMED, NETDEV_EVENT_BEACON_LOSS_NOTIFY, }; diff --git a/src/station.c b/src/station.c index 52d87c84..73de26bb 100644 --- a/src/station.c +++ b/src/station.c @@ -3444,12 +3444,6 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event, case NETDEV_EVENT_PACKET_LOSS_NOTIFY: station_packets_lost(station, l_get_u32(event_data)); break; - case NETDEV_EVENT_FT_ROAMED: - if (L_WARN_ON(station->state != STATION_STATE_FT_ROAMING)) - return; - - station_roamed(station); - break; case NETDEV_EVENT_BEACON_LOSS_NOTIFY: station_beacon_lost(station); break;