From patchwork Wed Jul 17 14:55:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13735507 Received: from mail-yw1-f174.google.com (mail-yw1-f174.google.com [209.85.128.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 D6923181B8F for ; Wed, 17 Jul 2024 14:55:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228133; cv=none; b=jI72TXTHf/z0/tdtef6ZU/Pomr5kGk0Y87x50DkFoX9LTvj2rJ67OUQ+cdeC/FO7PRhqYWSuJxq76q9Y9D+4/lWc1+boM6wIDlRwrUX44Z6yk4l2sg3WNf2TDuLErGKKlqQM1xZOtoqm6QO97L3j3rxNfR0Pa3Ots589apGSwTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228133; c=relaxed/simple; bh=wZ+kNudVV7hwu4gCZ4CWnYsGgwx3Egdac3AVoFktwuU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=hMONlCMUl5Z6DXz7v6xkSd8pEl0F8EBMe+cu2h3XchI22saX97gxpR/ENoI5AOMT/spR7slqOGO+sSoGDweV3VXdIVLzg6qJSeRh8WgmTlEoNjabgWCZnHeZ1Nk62U7GAGwQQXJrj+OyZoghTGOVstxG3QJTOnOVGAG5sqf2JE8= 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=m0Cz9xwZ; arc=none smtp.client-ip=209.85.128.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="m0Cz9xwZ" Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-65faa0614dbso45206647b3.2 for ; Wed, 17 Jul 2024 07:55:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721228130; x=1721832930; 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=7MToUH3sxHOEmHeBTXUaH2EP9mBA1Q5dI65ZttqNNPQ=; b=m0Cz9xwZn6sKxWfZxqE0dBtEAazMtYB6bzviSefF3wQJlMteXtcNosLDXpDK1UdjQc 01LNsj5SUBF7ODvdvdpUlc1AnsQcoL+u/73BgkXP/h5cuTPFEfwMPCsgzkEvi40LsYBO C1oNYCc+lVtUj/8Es6peW7yArw+3eCnNmHMol7pOw0yhv549gq/rPPDYqFmpfFU32xfu S7ulm9n55ZHfNEmXjRV0F0NutLYA8zJxdl4+aXPGbz57u3iG/r4DbitJwYIf9WqKs3Mm 6zEa1KrTMJh3U35ZdDc4dajl0TpgAivhbCa7+1x0Zw3RmVZ+y+rsrtWSGt79TqASk52I 9nDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721228130; x=1721832930; 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=7MToUH3sxHOEmHeBTXUaH2EP9mBA1Q5dI65ZttqNNPQ=; b=cSh4vRJakNRnMdToXFzwVzRKjphIDq4HNjWcLh/moLidMYASbGm9oO9C8AHb/DkzK9 u4F/SPgDyQhK1oPHXrO3UjDQkSCp/ySLf0i8nTE8XZV3fXnOfSDjJldzO8K5ka1XtFze s0f2/7SSmhkmWTiyLQbgDx2udRwSdXPhkU1hF2t7+ZjeZ+PHqu7zvl9bQZQU47lbCcTf aFTvwLf0Sj/zdo0e5DnLV2ivBKfgwa3v7uJVsBIjcf1d01gxj9UXVQYtgnKukRa58MB4 7KoQ+DWVDXcSJGPoXObDR+bBK/xcuF/qdT20PKQjyCE6sQ6x0RkACSgA1hD4fAknekwv qKNw== X-Gm-Message-State: AOJu0Yxojxf88nCaAY1Xi9KrgnCvJVNLz/FRCaIh627QcixOxr6qeDeZ +ckVlImIbgg/ziFDdy3Qsb5dZ3hvS2Zl10ocJ/3ZXaJMpx9wtNB6nIX1Iw== X-Google-Smtp-Source: AGHT+IEt8HnhgXjD8Nf1nmhEMwyYPthpm/yFhv5YzBQ4mwKgZyY1/dqIrFQ13NbySh0uNWyIya8Lsw== X-Received: by 2002:a0d:ff42:0:b0:64a:7040:2d8e with SMTP id 00721157ae682-665001960cdmr19297787b3.33.1721228129795; Wed, 17 Jul 2024 07:55:29 -0700 (PDT) Received: from LOCLAP699.localdomain ([50.78.19.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160bbff41sm407195885a.53.2024.07.17.07.55.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 07:55:29 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/5] eapol: move HANDSHAKE_STARTED_EVENT to eapol_start() Date: Wed, 17 Jul 2024 07:55:21 -0700 Message-Id: <20240717145525.2656306-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 This even is not used anywhere and can be leveraged in autotesting. Move the event to eapol_start() so it gets called unconditionally when the 4-way handshake is started. --- src/eapol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eapol.c b/src/eapol.c index 845ef866..6d176304 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -1036,8 +1036,6 @@ static void __send_eapol_start(struct eapol_sm *sm, bool noencrypt) uint8_t buf[sizeof(struct eapol_frame)]; struct eapol_frame *frame = (struct eapol_frame *) buf; - handshake_event(sm->handshake, HANDSHAKE_EVENT_STARTED); - frame->header.protocol_version = EAPOL_PROTOCOL_VERSION_2001; frame->header.packet_type = 1; l_put_be16(0, &frame->header.packet_len); @@ -2858,6 +2856,8 @@ bool eapol_start(struct eapol_sm *sm) eap_set_peer_id(sm->eap, network_id); } + handshake_event(sm->handshake, HANDSHAKE_EVENT_STARTED); + sm->started = true; if (sm->require_handshake) From patchwork Wed Jul 17 14:55:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13735508 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.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 541A3181B95 for ; Wed, 17 Jul 2024 14:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228133; cv=none; b=oI3dwq3I8aS0yX1+OpIOXRQgNdGwaYh4BuyrnK6A/E5UKFHAVKzGddOAHu4CNvdrc7T5FD6CHV4h/vFI8jeIoWFMV41grn6E0An7nMrnseRU7Z4MVtIkfiXfIGS0S57/FH0QvclYKgKY/daVY4RnXPo04/jP1fB2HNT9I3gwYFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228133; c=relaxed/simple; bh=TGAAW4NYA+/Y4VzLVrhPOmXIX84Sj33+H5noybSUR0c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uq05Llj3/FAT6KgFc0vrgIheXUhy4m8KYNNvgglfGyylDQrBXo84zD93/r8sU4ILf4k+aNKoQepyEXa1Lc+LXCVEHIIMExyXbGSxFYpiAajt07umGPmC3Q5a7YPjfu7Q0CqwWAP4b0TS4OZncf9SJEnH4GgOOFeCR5lMIEQKDyI= 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=SDF1wH7A; arc=none smtp.client-ip=209.85.222.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="SDF1wH7A" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-79ef82c6391so362454885a.3 for ; Wed, 17 Jul 2024 07:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721228131; x=1721832931; 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=2EWwYsj3H7RUvXP19XAS6eXUp+2yZiOBfg6yuMA1mqk=; b=SDF1wH7Av9wDnjwthB4a/Droz/6HnDfm0UivZ7mPaSC1/tYcgpFu1k2ShoGEuUDBUp 88N92XBWzceMzTgzloa6VE5CB9QmOmAO//m7qPoL8KGmT2qaZLp2SkpySHeN2rArY2Fu b8pIog1m6mFnpsUVCvwEYNIzbtbV04nRwCj9g735qB1PDGpdTZkeoW6bvG9fkIce6fko 1NrU1QJsmwPI2/0czNsodoQp7gwMjEASyptjtfe1GJ+6B4Lf6SG6+KpyQQtLT9HktEg4 dMuuc+eZTu3EYgEUxX2Ykw8lULxWxFNg233hejXREeQhF0UMcXxI8hCUAFH82cD5DuHb cFNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721228131; x=1721832931; 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=2EWwYsj3H7RUvXP19XAS6eXUp+2yZiOBfg6yuMA1mqk=; b=pasNH1lyb65lOd/DlcV1miukng8nszwaRzG1G/ogGqW9QqqGBTviL5VdbInxfDxyLW UuhYyJOhEdBTZNOPQ4D8kOkL6mZ8I9ew2PFxTXgXjF9MjTdwM/I6aePryD3hEjqtK25K XZZUoRW7nV3uomukzmi8+rV+Ppc39QB391Kklmx1tv8h4hJETbe28Zol5X99Ssu3SRtd blGINT+RrsGEIs6jqI0UmbXRP9c9c5meJKt9j4tCHmnmH1yDELmLSu5UBkttEZUAYxZf p0GqXTN4nZBYMhoH1wAwlbTlMG2+4aUxQBg6RfkNNNPTR084jTU6v+qBtDtMyFO7olO1 bPig== X-Gm-Message-State: AOJu0YwrLP5H0A9M2aLWbm3VmSsjGkTAFpnXciNG+MWgbjZhzAz13EQE gckn7tVr5Xu8FGRTY9PqvMQe9XimDI7uGBXMyKLhGDzO8hL46NUpQy3mDw== X-Google-Smtp-Source: AGHT+IGPbDZKHMaoLaZkymwhS6wRVMV0SN2BTRrUtuhC+CYOPOPoXlIk4wTPuo0oNHelqw3NmxOQsQ== X-Received: by 2002:a05:620a:29c1:b0:79e:f9f0:4347 with SMTP id af79cd13be357-7a187448b81mr189713785a.24.1721228131006; Wed, 17 Jul 2024 07:55:31 -0700 (PDT) Received: from LOCLAP699.localdomain ([50.78.19.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160bbff41sm407195885a.53.2024.07.17.07.55.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 07:55:30 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/5] station: add handshake-started debug event Date: Wed, 17 Jul 2024 07:55:22 -0700 Message-Id: <20240717145525.2656306-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240717145525.2656306-1-prestwoj@gmail.com> References: <20240717145525.2656306-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/station.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/station.c b/src/station.c index 05392fa2..bec19d79 100644 --- a/src/station.c +++ b/src/station.c @@ -1015,6 +1015,7 @@ static void station_handshake_event(struct handshake_state *hs, switch (event) { case HANDSHAKE_EVENT_STARTED: l_debug("Handshaking"); + station_debug_event(station, "handshake-started"); break; case HANDSHAKE_EVENT_SETTING_KEYS: l_debug("Setting keys"); From patchwork Wed Jul 17 14:55:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13735509 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (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 76238181BA7 for ; Wed, 17 Jul 2024 14:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228134; cv=none; b=HtVwbzQtyRczcYJNrtJAh1sqM/xIeGT1X+3AImDUvKFRGEjRngjMnNjI1AyiBPpHFeIzgEw17AGoVYQF/mFhO2hDBjCxdH1nJWJexB8ewY7q2GGzq44CYYCXKxzGp3bh5SFQYAx6C+sji+HZye5mbnkKgfKNv06XOLGgkpvDrMo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228134; c=relaxed/simple; bh=BeueZWDXixymJFyPRdsGIekPtFW//6cluBuzP7j4x9k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cJWVFv3uPysT3M4kHPJ3wc3o/WrSbHU+OqgsXwkahHv6XWHheoim5vMoHP9iIyelfLg5kjEXeGV32kL0NkslTdbU1CSdnedcGqh2LsaN4B2F6b4+NyVLUMhFqxv/PPTl8sAVl+sN+mtyzSHLbcld6II0/G0J2fIGFUAEnI76L1o= 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=i2yPSqiy; arc=none smtp.client-ip=209.85.128.173 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="i2yPSqiy" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-65f880c56b1so43952647b3.3 for ; Wed, 17 Jul 2024 07:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721228132; x=1721832932; 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=N1iztXrJVzy+bdpMpzcoTbj2hxX9w4+Z1fDvnyjiApo=; b=i2yPSqiy3uz2Zffpb547cAXvsEGmPpW1uC7xGdVT4CmK7Uz8FtWXPHCTmtWE4wIiEj E3LkYe59PCCDsCTac/jBpV26itmj50YXPNgAZvTdIy6ucBo7hgoTE+4QcXIrBcd7jc5q F5haLqwQWYOEmyAbPLfC40m7Eoh+ULzlzaGVMLorsvFN4EaUoJA46PXhW9rZI92pA5dg Fug2+IRXMdfUOb6EL5t7kh2Sl431FYrnfwkZP2TKzZD3G4b0F0ltZpwPVwlD3OthwvOX PrsUjTQsksHywYHFngV2xRi2ub7zmuw6sJFE+3xB7x7ZjM8prNk0o7fvfpP+Uxj5zoF8 B8jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721228132; x=1721832932; 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=N1iztXrJVzy+bdpMpzcoTbj2hxX9w4+Z1fDvnyjiApo=; b=Ixlbhixq2qsO19jQrAoGNG57vLyH3yiLeTJ+IVoXOvIbYgZG7t2+Uufqdjwrjuxy/u 4uk6xcDXXM4MNm+mZKsPyl+ZwJVi6+kGK+9csYGT5nexN0AZFRXjUel6FAwU2jULcDxq 4KI2f7Vd+whloOxo2KzdUq8xGIwXv8oxS8MoT7aQPcu8wG7+VU1qE3l1mFXu/BKOiPIm iqvLxD52RWOYdhUWnIGNCHdfE1sbLu37caYN7y+vsyfWw01mMWF5pWYBM+W35Kp7wuMO pm7U+C8q8gKy9xrwdszi7LPdqBQI/13qcgKxENbev2SYwOMDZ83/Pt9XqbgjMWUCA+5g 3AsA== X-Gm-Message-State: AOJu0YzE+7ZkKxkfhGvDgdPaHfMn4dwBC65ZbPsxbv7oS41g91sSV8DC LlJ8GB9hUWS5wu7TJMX1FjhcjdnAJbHnNJ91xPvqwHA79zFY+ojel36kRg== X-Google-Smtp-Source: AGHT+IESFo6GJr7Rva2zmuLRcJjqfWRlphOLb0fxthMTVWuFVKXds8Ximx+Dy9vbnMJWWIJ7iZ79GA== X-Received: by 2002:a0d:d382:0:b0:664:7fb6:a5f9 with SMTP id 00721157ae682-664fea2c132mr21548657b3.21.1721228132162; Wed, 17 Jul 2024 07:55:32 -0700 (PDT) Received: from LOCLAP699.localdomain ([50.78.19.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160bbff41sm407195885a.53.2024.07.17.07.55.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 07:55:31 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/5] auto-t: add clear_events() to IWD class Date: Wed, 17 Jul 2024 07:55:23 -0700 Message-Id: <20240717145525.2656306-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240717145525.2656306-1-prestwoj@gmail.com> References: <20240717145525.2656306-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The wait_for_event() function allows past events to cause this function to return immediately. This behavior is known, and relied on for some tests. But in some cases you want to only handle _new_ events, so we need a way to clear out prior events. --- autotests/util/iwd.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 511fb3a5..1d4a5472 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -299,6 +299,9 @@ class StationDebug(IWDDBusAbstract): return False + def clear_events(self): + self._events = [] + def wait_for_event(self, event, timeout=10): return ctx.non_block_wait(self._poll_event, timeout, event, exception=TimeoutError("waiting for event")) @@ -859,6 +862,9 @@ class Device(IWDDBusAbstract): def wait_for_event(self, event, timeout=10): self._station_debug.wait_for_event(event, timeout) + def clear_events(self): + self._station_debug.clear_events() + def event_ocurred(self, event): return self._station_debug.event_ocurred(event) From patchwork Wed Jul 17 14:55:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13735510 Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.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 66E83181B95 for ; Wed, 17 Jul 2024 14:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228135; cv=none; b=BYJQOWB56sb60XhsV803rMr0x8/muYR6h1s09Ec656W58zLNOeivhCoMGxS+RCL3J1/u9VqpReeR4eBD4ZgjiP7Rb2SalBE8yA3ulPjZgIt1o2lFetKwnEHiEVnL04j4WgaFCrz7R0W8ZfRLgQBXxw1rECtZMuJ8bGjcgfZjD8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228135; c=relaxed/simple; bh=OlwDQKwFC/ByBRnpX0xVvs24NfSuyYAHZ+AMsdfvDmg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=J27NwwpapCpqGUv3bnNubRS6fShQ61WeRD4fbquP3E5Dy+szO7Hr0d+KeCKAudBpg2yaNGVeIACeZB0vUeaGW1ngciXC3YF6ede1JdZDbiLHqbPubQeX5WkGsLQH3rlw27InUFKm91mz+i0SHYycywgL0zBPj5n6dQ9gYff2MOw= 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=OZc8Fgcs; arc=none smtp.client-ip=209.85.167.171 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="OZc8Fgcs" Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3d9dbbaa731so205738b6e.3 for ; Wed, 17 Jul 2024 07:55:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721228133; x=1721832933; 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=d//Q+wVntkq41Q+k/oiO3Y1C/TZAIgUS+B96eAH9Il4=; b=OZc8FgcszOK5WuyKWcpIFEklvNtHC2/A8Qx4tezGs0DwOkIzsHNMD8BzoZzlfOKycR /vHeWNgQS+8BfP7+7oaXF+EFjsCUPKG6C0qYjUexbQ9UNoIRRcwP5O5fEUcdKevLQN4S gYd3NvzyKBv7UzxA7rozBQLjkvKpSOtRa6PlkCk/YKhltEE4Jiw3XWl279W5mHz5WwL3 8z1h02bZtNUfr1Vubnhzf3s1DEaYaIri1huV/Zv7qIaz/S8abDhs2IQE0F4koY6SUcEW DRyftnE44raYUeJfHh5rJ20uiqzkr5FpPLpPXFh4fdrof/wLFeogK/L2SSr1srmJ7uCd BmPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721228133; x=1721832933; 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=d//Q+wVntkq41Q+k/oiO3Y1C/TZAIgUS+B96eAH9Il4=; b=wQ47gabEIbmRrqFIMJii1NyqHdvNQmr4B8soEc2e8JndlTiS22Xw6ECGSW/Hmm8701 1fWsPiDkt4DMYoSXDZHk7QPhQx37KzHApfzRoTTLeEV0mD1tL7pPAEDhUGsv7KP2QKIS 0Y8sJkClInGgDD1iIMMN8KHhTd0erLUMtT5bihpthYbcm5J/VxjzWnLJ/fWIV5lmuvx/ kSA9vOUuOEywPco3WHqfK6a2BYZP3HbWWD30/x24wkNBrq1PyFqs9P8QztYsTu2pNkNJ ukn54ZOL5AXEUNbMWUZCK+uVaVhU9aFpYg8g15T25vP7Rqc04uniZa9McWAdioRxztaw Xl2A== X-Gm-Message-State: AOJu0Yx3AntAaQtAbn579G0Q60J70GA+NbpCEmdfc64FbB8GP4zrJUEC xVYmg8OIwsjf7Y3s/mKGfqGCZYBzSpvkwLBcA3ocqIFsfZKZKwmaW//DBg== X-Google-Smtp-Source: AGHT+IHzQgnw0AoDkPVLbBB64Zr5382sH/gFcQk1nmK9bl90XsJ+Cpze2deW4DrmdmCoELd4iIjtCA== X-Received: by 2002:a05:6808:14cc:b0:3d9:39fd:bda8 with SMTP id 5614622812f47-3dad1f8b9cbmr2288342b6e.39.1721228133353; Wed, 17 Jul 2024 07:55:33 -0700 (PDT) Received: from LOCLAP699.localdomain ([50.78.19.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160bbff41sm407195885a.53.2024.07.17.07.55.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 07:55:33 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/5] auto-t: add reason/test arguments to hostapd deauthenticate Date: Wed, 17 Jul 2024 07:55:24 -0700 Message-Id: <20240717145525.2656306-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240717145525.2656306-1-prestwoj@gmail.com> References: <20240717145525.2656306-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The reason code is obvious, but the test argument is actually a toggle to send the frame encrypted or unencrypted. --- autotests/util/hostapd.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py index 2f92e330..e5e35a96 100644 --- a/autotests/util/hostapd.py +++ b/autotests/util/hostapd.py @@ -184,8 +184,12 @@ class HostapdCLI(object): cmd = self.cmdline + ['wps_pin', 'any', pin] ctx.start_process(cmd).wait() - def deauthenticate(self, client_address): + def deauthenticate(self, client_address, reason=None, test=None): cmd = self.cmdline + ['deauthenticate', client_address] + + if reason: + cmd.append(f"reason={reason} test={test}") + ctx.start_process(cmd).wait() def eapol_reauth(self, client_address): From patchwork Wed Jul 17 14:55:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13735511 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 021D8181BAC for ; Wed, 17 Jul 2024 14:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228137; cv=none; b=RfgIhdwPSmpCqO5Zr5hnYCGJghvplfr5hSFhlIx2MmWG6+H/ScWKBj/VSiBy9hIFt9erLN4tEzyq0RdcPiVc2Bwa2oNk/4yq4EyzPjH3FqBeSTRiGKj8USDaZtbPhtG1zDgW6XCCwHPfOtJrkvQIRPP/0FAOT23PsVqjuiD+RsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721228137; c=relaxed/simple; bh=c/2V3qivgem7wxMjLwhuC1XwQlgqFogeUaojRH3DJHQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sk+CODJmt4K6f/17iC6SU8lko5YSmkGEQZTSit0Qo3H3C6tl6DLju03XCb9TG7Fk3TWZgtXxIHdkvD+wGvW2iGzUcGi4wDyWw9Ul2afI4iCziGJWQ4BQYYtn+THKQl/LJEMfeKL+KerUyfkETsYqr5we8O3tVB7aNT62EkC3ILE= 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=RX/1Sn6n; arc=none smtp.client-ip=209.85.222.178 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="RX/1Sn6n" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-79f178351d4so432892085a.0 for ; Wed, 17 Jul 2024 07:55:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721228135; x=1721832935; 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=cr/5yUOrGHfHDvlWYS8wXxrYoFlLdaVtu3+ed47QWLA=; b=RX/1Sn6nSALf+r4gEtgErkZWP0g0USnWFNqKcDHl6IYraiHMeMYuh/RDDh/hv2plzU mltwZlCWKI9d4+rz2UWK4VzOpDLe5QV0ngSuZwxmlUlLM2pXGPPs57rMt9aIeICY/tBE zHkhtl23KYfj255DOOQ6u/3bpFJdco5lCOM2oT3lJUX3Hze2YgSrSb+KxWFkBdhubXEi WeeaFwCpIwPQGrHNE7JOynR16+J85E9Z/egR1waNz5lwOFHIMyCgfeJiV1Fh5/caREC/ S8ZriROAPMNRqpROm5T9Zjuez4tjhaizKbhQmLcgVa0RmYyigpdLNiCXaJqO5c+7Myw7 mB9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721228135; x=1721832935; 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=cr/5yUOrGHfHDvlWYS8wXxrYoFlLdaVtu3+ed47QWLA=; b=r7PWvcFuyzPpy0enDk3iIp16HZIOkibUjRGPvXHejQGQvHvjTkcqcN0H0xfC1nDPNP BZzKQwxyw95imasDwOrSQZzWkYWe+gZOj1S0VL9LVmPFov2fzYT/vVeTih6hMkcvU9xC w1yZJDK3Zi9QLl493TJYeGgleZRp3yTa4nDVFEYpbS+QFS19DUV+rOElo3Oo8HPJtxzy URmJhcwkcpccy8ykGY2NOq+VTGfD7WkB/jZ1GlcKqmIPg7MCZBWeVtwlbLrFt20Xn4Sv GLIkPtGNoCu5ObbblrO+IvbCndBXU0o9lXiI/+to2uutqB8YrssVmLZIpmEdYRy0UxZP xyrg== X-Gm-Message-State: AOJu0YxRCku/I+KKp9IRszV4gQT1dIOCrF8F3isN0Z+sO3T+P5yyuI5w zcGEgiixemH09A1lUAs9IEA1DNNkcDFyU/J+U0NQeRQxqufvhx1xJaCRog== X-Google-Smtp-Source: AGHT+IEbDpCAy2mIHarV3G27fhZRTdnruC+EzgOjOGhzKMx1LCSOiAJ/EJaI4pMi0Fli7p/aWtwutA== X-Received: by 2002:a05:620a:190f:b0:79f:556:5f31 with SMTP id af79cd13be357-7a18746e0c8mr211460585a.37.1721228134654; Wed, 17 Jul 2024 07:55:34 -0700 (PDT) Received: from LOCLAP699.localdomain ([50.78.19.50]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a160bbff41sm407195885a.53.2024.07.17.07.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jul 2024 07:55:34 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/5] auto-t: Add deauth during the 4-way handshake test Date: Wed, 17 Jul 2024 07:55:25 -0700 Message-Id: <20240717145525.2656306-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240717145525.2656306-1-prestwoj@gmail.com> References: <20240717145525.2656306-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This test will fail with current upstream as IWD hangs when the deauthenticate event arrives. Once this is fixed the test should pass. --- .../disconnect_during_handshake_test.py | 118 ++++++++++++++++++ autotests/testPSK-roam/ft-psk-ccmp-1.conf | 2 +- autotests/testPSK-roam/ft-psk-ccmp-2.conf | 2 +- autotests/testPSK-roam/ft-psk-ccmp-3.conf | 2 +- autotests/testPSK-roam/main.conf | 3 + 5 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 autotests/testPSK-roam/disconnect_during_handshake_test.py diff --git a/autotests/testPSK-roam/disconnect_during_handshake_test.py b/autotests/testPSK-roam/disconnect_during_handshake_test.py new file mode 100644 index 00000000..c5016cd1 --- /dev/null +++ b/autotests/testPSK-roam/disconnect_during_handshake_test.py @@ -0,0 +1,118 @@ +#! /usr/bin/python3 + +import unittest +import sys, os + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import PSKAgent +from iwd import NetworkType +from hwsim import Hwsim +from hostapd import HostapdCLI +import testutil + +class Test(unittest.TestCase): + def validate_connection(self, wd): + device = wd.list_devices(1)[0] + + ordered_network = device.get_ordered_network('TestFT', full_scan=True) + + self.assertEqual(ordered_network.type, NetworkType.psk) + + condition = 'not obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + self.assertFalse(self.bss_hostapd[0].list_sta()) + self.assertFalse(self.bss_hostapd[1].list_sta()) + + device.connect_bssid(self.bss_hostapd[0].bssid) + + condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_condition(device, condition) + + self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address) + + testutil.test_iface_operstate(device.name) + testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name) + self.assertRaises(Exception, testutil.test_ifaces_connected, + (self.bss_hostapd[1].ifname, device.name, True, True)) + + self.rule0.enabled = True + + device.roam(self.bss_hostapd[1].bssid) + + device.clear_events() + device.wait_for_event("handshake-started") + self.bss_hostapd[1].deauthenticate(device.address, reason=15, test=1) + + # Check that iwd is on BSS 1 once out of roaming state and doesn't + # go through 'disconnected', 'autoconnect', 'connecting' in between + from_condition = 'obj.state == DeviceState.roaming' + to_condition = 'obj.state == DeviceState.connected' + wd.wait_for_object_change(device, from_condition, to_condition) + + self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address) + + testutil.test_iface_operstate(device.name) + testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name) + self.assertRaises(Exception, testutil.test_ifaces_connected, + (self.bss_hostapd[0].ifname, device.name, True, True)) + + def test_disconnect_during_handshake(self): + self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK') + self.bss_hostapd[0].reload() + self.bss_hostapd[0].wait_for_event("AP-ENABLED") + + self.bss_hostapd[1].set_value('wpa_key_mgmt', 'WPA-PSK') + self.bss_hostapd[1].reload() + self.bss_hostapd[1].wait_for_event("AP-ENABLED") + + self.validate_connection(self.wd) + + def tearDown(self): + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" down') + os.system('ip link set "' + self.bss_hostapd[0].ifname + '" up') + os.system('ip link set "' + self.bss_hostapd[1].ifname + '" up') + + for hapd in self.bss_hostapd: + hapd.default() + + self.wd.stop() + self.wd = None + + def setUp(self): + self.wd = IWD(True) + + @classmethod + def setUpClass(cls): + hwsim = Hwsim() + + IWD.copy_to_storage('TestFT.psk') + + cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), + HostapdCLI(config='ft-psk-ccmp-2.conf') ] + + unused = HostapdCLI(config='ft-psk-ccmp-3.conf') + unused.disable() + + cls.bss_hostapd[0].set_address('12:00:00:00:00:01') + cls.bss_hostapd[1].set_address('12:00:00:00:00:02') + + rad1 = hwsim.get_radio('rad1') + + cls.rule0 = hwsim.rules.create() + cls.rule0.destination = rad1.addresses[0] + cls.rule0.prefix = '08' + cls.rule0.drop = True + + HostapdCLI.group_neighbors(*cls.bss_hostapd) + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + cls.bss_hostapd = None + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testPSK-roam/ft-psk-ccmp-1.conf b/autotests/testPSK-roam/ft-psk-ccmp-1.conf index b46d1f27..839eb496 100644 --- a/autotests/testPSK-roam/ft-psk-ccmp-1.conf +++ b/autotests/testPSK-roam/ft-psk-ccmp-1.conf @@ -13,7 +13,7 @@ wpa=2 wpa_key_mgmt=FT-PSK wpa_pairwise=CCMP wpa_passphrase=EasilyGuessedPassword -ieee80211w=1 +ieee80211w=0 rsn_preauth=1 rsn_preauth_interfaces=lo disable_pmksa_caching=0 diff --git a/autotests/testPSK-roam/ft-psk-ccmp-2.conf b/autotests/testPSK-roam/ft-psk-ccmp-2.conf index 3e215457..2ffd7262 100644 --- a/autotests/testPSK-roam/ft-psk-ccmp-2.conf +++ b/autotests/testPSK-roam/ft-psk-ccmp-2.conf @@ -13,7 +13,7 @@ wpa=2 wpa_key_mgmt=FT-PSK wpa_pairwise=CCMP wpa_passphrase=EasilyGuessedPassword -ieee80211w=1 +ieee80211w=0 rsn_preauth=1 rsn_preauth_interfaces=lo disable_pmksa_caching=0 diff --git a/autotests/testPSK-roam/ft-psk-ccmp-3.conf b/autotests/testPSK-roam/ft-psk-ccmp-3.conf index 3e215457..2ffd7262 100644 --- a/autotests/testPSK-roam/ft-psk-ccmp-3.conf +++ b/autotests/testPSK-roam/ft-psk-ccmp-3.conf @@ -13,7 +13,7 @@ wpa=2 wpa_key_mgmt=FT-PSK wpa_pairwise=CCMP wpa_passphrase=EasilyGuessedPassword -ieee80211w=1 +ieee80211w=0 rsn_preauth=1 rsn_preauth_interfaces=lo disable_pmksa_caching=0 diff --git a/autotests/testPSK-roam/main.conf b/autotests/testPSK-roam/main.conf index 3d93ff57..a6887c9c 100644 --- a/autotests/testPSK-roam/main.conf +++ b/autotests/testPSK-roam/main.conf @@ -3,3 +3,6 @@ DisableMacAddressRandomization=true [General] RoamRetryInterval=1 + +# For disconnect_during_handshake_test +ManagementFrameProtection=0