From patchwork Tue Jun 25 13:06:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13711118 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.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 68FF11DFC5 for ; Tue, 25 Jun 2024 13:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320802; cv=none; b=L7aNOhUi1oOvLeN0tnf93/iGXh3PGvMgKBAZb/sgGaXRV6KSLFfpyF2VNqwGoiisjb2jMP3xcL4vKI2n/Wyqxaw7yF5gvWCry/Ves3aK121HG6IQDdvzowy6xqhZC0ZV0EUftvSL6/1z9EqrS/OHqQTZZh8fzwPIuQzMbPoxb/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320802; c=relaxed/simple; bh=RCaWVQcR9A7imwYjqT8S60TtbVUlnoG2+25cuKluqgg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=df/11BDVuEMV7ucgaHod/dfR79yX/89+Pqt3LmphtFzEVXn68Gq+WFTDBYxb4P6ahSge30iCE9pnDqtaNH7Q5zY9Q+Cv+KVSNJDzMCuz/1vyUwPv7fpEQeMtCLNjuzEmmF/7os9zBYEvynqwE4rzGe1iN3gEorJjNo4pRcbbs4Q= 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=B52gwPkb; arc=none smtp.client-ip=209.85.214.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="B52gwPkb" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1f9b523a15cso39335905ad.0 for ; Tue, 25 Jun 2024 06:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320800; x=1719925600; 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=Fs2IB9eeSxruGP/2upHGcxD2i9Ylwf0yAcwE+BbQGhU=; b=B52gwPkboJjZA48CsaxFpaPOxTUZgYtPOS84MibYmOcjaTEVz5CqVAmpmAIgN5e4RQ lgvs7vsVl7HpGjt0eLXHNSlSFRSs0hC3Hucb4+/041nV8Hrldn8JxIV8eWMBMvkDCotf sqN7uc8FU1yrxM00DUTMCVOICH+299LEvehZFFgfGeb3tqBSFRVhJf7+qzXEMZ7dJPgW IbzM35GPolMoYIH+/lmI1nyfqeadwpca44WzIxOHwItIoI0E1urHGVCeBegORD21jSft DZRRum4SP4IOiKzimtCAv374OwWUWKmKGDSXocVRdmg8HPdbPswmkA4EcwGASd4syh3w nVdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320800; x=1719925600; 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=Fs2IB9eeSxruGP/2upHGcxD2i9Ylwf0yAcwE+BbQGhU=; b=IsTIQYXChRAAS2rs2WfTFd+dknueen55wHNPbpEFFzGdkLe3MG5eDc0JLRS3f8Zely G5+K/qWHDdn9rUfgxgIeEvaMo05BNNW0/nrBxx5hjWSfLaHqaqEzLxuxWUREP6JNwT3m CGnod8WXQquPwenziJYAwzZVLUVqLnvOB3dQj/DghC915sX7p17XDbq7pfEdTqcRzyLd Q7Is1zCSmycfUXPp2J/KlDt8PTUNrWV4Xppsr0RVF8AWBdWehzAjErKpGtMnbqEd9NY1 CTi0U9T7EoYmCt/08T6akxYFcF9UcihkTN1+y4J8LJbvnEEGQ7llzBU+dJJkvipdY9zj Vpcg== X-Gm-Message-State: AOJu0YwbU1qHNyoHxJuNFaSkqtrXpkxYm3eYnKOgE5HSqrhOsQYuOZDj FgrCRxrNk8egXRUTRbYl/in6ZwGABhTsmlAygvspkBih9iu/ICL4R4xOTg== X-Google-Smtp-Source: AGHT+IH1ZovZkbXzsnTe/KBFEpj6pBiq9Lt8zuLL84yhTSr1BuJqlcKbUUkTjJHlruLcu9c3EnD3QA== X-Received: by 2002:a17:903:228b:b0:1f9:f6e6:5ada with SMTP id d9443c01a7336-1fa0fb04498mr118361715ad.22.1719320800252; Tue, 25 Jun 2024 06:06:40 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:39 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/7] netdev: use nl80211_parse_attrs for deauth event Date: Tue, 25 Jun 2024 06:06:18 -0700 Message-Id: <20240625130624.385553-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 Especially for parsing a single attribute, nl80211_parse_attrs makes the most sense to use here. --- src/netdev.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 5b79d267..bada1ab5 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -1328,12 +1328,10 @@ static void netdev_cmd_disconnect_cb(struct l_genl_msg *msg, void *user_data) static void netdev_deauthenticate_event(struct l_genl_msg *msg, struct netdev *netdev) { - struct l_genl_attr attr; - uint16_t type, len; - const void *data; const struct mmpdu_header *hdr = NULL; const struct mmpdu_deauthentication *deauth; uint16_t reason_code; + struct iovec iov; l_debug(""); @@ -1349,17 +1347,11 @@ static void netdev_deauthenticate_event(struct l_genl_msg *msg, * deauthenticating immediately afterwards */ - if (L_WARN_ON(!l_genl_attr_init(&attr, msg))) + if (L_WARN_ON(nl80211_parse_attrs(msg, NL80211_ATTR_FRAME, &iov, + NL80211_ATTR_UNSPEC) < 0)) return; - while (l_genl_attr_next(&attr, &type, &len, &data)) { - switch (type) { - case NL80211_ATTR_FRAME: - hdr = mpdu_validate(data, len); - break; - } - } - + hdr = mpdu_validate(iov.iov_base, iov.iov_len); if (L_WARN_ON(!hdr)) return; From patchwork Tue Jun 25 13:06:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13711119 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.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 1DCFD1DFC5 for ; Tue, 25 Jun 2024 13:06:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320804; cv=none; b=V36aESHwsfj67j3065kdgo3Ws2mTGZOpsNaOKw81RF1VCP7kAnG6zRQURoHInG8/zzFnZUo6J1Htx+joCcr0jI1ROh29iq+POhj2303p+bBQSbMa1gPKGSHp15u5yPQpmIwuZq6LtA/eC1xg5kS+KVdsz/ueZySOHTVgvvKydhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320804; c=relaxed/simple; bh=CoC/KIdxvjtpsPj6dQFrj4n+ScD1uofc7OC15kF1aqQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rqtSB0hCJ1YOp9hnHHZz8XRyodeBWRoxzVNFXjuERWneJGy/dEUcKavt3CWLLBSUim9KJdpEAATArBedOWnIj0dexZydVc0p0E/MDTjWxj0fbHPEJxRWMrVZCDh3L5ZWzlO/kYttOc4DNW1ENe6R00GI7fZP94OYip7PGwxVaDY= 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=H4TwR2oY; arc=none smtp.client-ip=209.85.214.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="H4TwR2oY" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1f4a5344ec7so37383335ad.1 for ; Tue, 25 Jun 2024 06:06:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320802; x=1719925602; 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=n7s5jUFXHrWv1UL5cLoznJmUrDZSIR9KIuI8ExjIwP0=; b=H4TwR2oYPAu9n/W9F2mlhrezwatakEpf75kS6EKs34Z5MUXKjTmOjQVMRf+2/lcqT4 7HC6mfv59D6SlaTL7cVTEDgn/xr9OjmMarzt6l4CiK+3Guz+Mre0Pc8KQ3ovPDIWLFR6 evzRnGT/kI3WXwUpm5jiBt1hlcnnDF8uFZoy6MaVXrYJBYUVrtpYuoeYUM4jd1GJb4RN Arn9EApVAxsJJXwmf/sHrgyztWT/j6921dfyaeY4wtCxZLmitlQiLm68NkM3Fq5ip5lx 6MABDWAEk9WF2YE7ANngENtOa+9xrrC1z9ZjlagMC+6C8UIgaXvXLpY7FWVAIlQmYdD5 fm4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320802; x=1719925602; 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=n7s5jUFXHrWv1UL5cLoznJmUrDZSIR9KIuI8ExjIwP0=; b=N16aJUT6btYeLkSL29e/X0euUeUUX+IMRD0HdfyOfF6erGL6ya+R4YZF8ZG11vPdK4 E9hEvhHaZ58avz+7HdnCnmVkQcOODEwmupxxMgciIk+gY9pKWvpouOoqfNtyVR4MCfB5 b4NIZE19nf8RShuqB43LG/VfqF3OAC35+BzhQD3Mx/W/NXnnztxxZxpkAZ128WBvltm5 uZ/MaVOqYgsodbBJD+fcl46buc/747brJnuzeHgyUN6vXbpP9Qkv1QoUHZuzkH/GuYFm uM92A70ZFGir4TXpgJAJvsdmNyfO3wVyzbnbaM1Dzm+fXf6V91mVbfWPL0F61pXZEsFT WQLQ== X-Gm-Message-State: AOJu0Yymk20/MrVHuFi/TY6CHJ4nqptxmIeveTZ4QcPzn3Fhap8SIIqq kxjQ948mMJDuz06YS0wBnb8gPA1vHDf8kf6cYQ8aytHjjZHzSfAYgbtLjA== X-Google-Smtp-Source: AGHT+IFGe98nHmrug9NH51Sp4zzQdT1kFfbVCuRX72MsTrRs/5Ak4r/wWEOMyirOgUaoDaBlb30XSg== X-Received: by 2002:a17:902:d2d0:b0:1f4:6fad:ba59 with SMTP id d9443c01a7336-1fa5e674ea3mr58912375ad.14.1719320801851; Tue, 25 Jun 2024 06:06:41 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:41 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/7] nl80211util: use nl80211_parse_attrs/nested for get_key_seq Date: Tue, 25 Jun 2024 06:06:19 -0700 Message-Id: <20240625130624.385553-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625130624.385553-1-prestwoj@gmail.com> References: <20240625130624.385553-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This really reduces the number of checks needed and overall function length by using the helper APIs. --- src/nl80211util.c | 51 +++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/nl80211util.c b/src/nl80211util.c index ac4ad223..eaf9f610 100644 --- a/src/nl80211util.c +++ b/src/nl80211util.c @@ -184,6 +184,7 @@ static attr_handler handler_for_nl80211(int type) return extract_iovec; case NL80211_ATTR_WIPHY_BANDS: case NL80211_ATTR_SURVEY_INFO: + case NL80211_ATTR_KEY: return extract_nested; case NL80211_ATTR_KEY_IDX: return extract_u8; @@ -208,6 +209,18 @@ static attr_handler handler_for_survey_info(int type) return NULL; } +static attr_handler handler_for_key(int type) +{ + switch (type) { + case NL80211_KEY_SEQ: + return extract_iovec; + default: + break; + } + + return NULL; +} + struct attr_entry { uint16_t type; void *data; @@ -322,6 +335,9 @@ int nl80211_parse_nested(struct l_genl_attr *attr, int type, int tag, ...) case NL80211_ATTR_SURVEY_INFO: handler = handler_for_survey_info; break; + case NL80211_ATTR_KEY: + handler = handler_for_key; + break; default: return -ENOTSUP; } @@ -568,46 +584,29 @@ struct l_genl_msg *nl80211_build_get_key(uint32_t ifindex, uint8_t key_index) const void *nl80211_parse_get_key_seq(struct l_genl_msg *msg) { - struct l_genl_attr attr, nested; - uint16_t type, len; - const void *data; + struct l_genl_attr nested; + struct iovec iov; - if (l_genl_msg_get_error(msg) < 0 || !l_genl_attr_init(&attr, msg)) { + if (l_genl_msg_get_error(msg) < 0 || + nl80211_parse_attrs(msg, NL80211_ATTR_KEY, &nested, + NL80211_ATTR_UNSPEC) < 0) { l_error("GET_KEY failed for the GTK: %i", l_genl_msg_get_error(msg)); return NULL; } - while (l_genl_attr_next(&attr, &type, &len, &data)) { - if (type != NL80211_ATTR_KEY) - continue; - - break; - } - - if (type != NL80211_ATTR_KEY || !l_genl_attr_recurse(&attr, &nested)) { + if (nl80211_parse_nested(&nested, NL80211_ATTR_KEY, NL80211_KEY_SEQ, + &iov, NL80211_ATTR_UNSPEC)) { l_error("Can't recurse into ATTR_KEY in GET_KEY reply"); return NULL; } - while (l_genl_attr_next(&nested, &type, &len, &data)) { - if (type != NL80211_KEY_SEQ) - continue; - - break; - } - - if (type != NL80211_KEY_SEQ) { - l_error("KEY_SEQ not returned in GET_KEY reply"); - return NULL; - } - - if (len != 6) { + if (iov.iov_len != 6) { l_error("KEY_SEQ length != 6 in GET_KEY reply"); return NULL; } - return data; + return iov.iov_base; } struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex, From patchwork Tue Jun 25 13:06:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13711120 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.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 66A1714D28C for ; Tue, 25 Jun 2024 13:06:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320805; cv=none; b=g5i1p1pZccTXazeSMhs+GIcEGmct48KLPaYcM5XR2tw6G20KuR/MbY37lnndqcipDs6ObABCZeZb3N3y3ZLsskTfgrMFhMmVHaEvtD7IyMEAL7nnIwn7+DLY9JK/MGlJVnm+7PEfJGHuMlZtjjygDeNCp+QXOlEYZH9oC2HJ/uI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320805; c=relaxed/simple; bh=S5h0/COxgm0SpL29UrN3tnd96ZIrTl+ZSzPBft+cC+8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nJq6QeSjosimR7h+wzu9rpVtRvsfpBXficXcx/EbpwGu7dy1X6gXAOfmrxmjDNBZuQUvy9vGZwti9JWX7JO67mfkRb6SzXEn5ONkbChM6rw6hpt0P/1Wo78pKpGGFUHD/ofnHmMlaesCq+4+XPq0PFsQul2jAbVwXcgHFUA+wt8= 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=KbnIqs/3; arc=none smtp.client-ip=209.85.214.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="KbnIqs/3" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1f4a5344ec7so37383655ad.1 for ; Tue, 25 Jun 2024 06:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320803; x=1719925603; 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=k8CBQYgpPSbhoWM3/U9KW2bBBLwbvBk02G8XBXzJ5KI=; b=KbnIqs/3HExu/tqM14xFQvxVTbyDRSS1yhp6LYQwM8E5eyR19XS2HP29jxvqAzuXaJ USW4f5abMczUlrFx639b58lB7bimdiwAcy6YvaKMLX8q2ECPhmTepMg307YlRG5vPaWQ Isav8CQ7L6xwC6xQsM76sxU0dNhmrpr7nNLxpcv6Yuv6juSXH0FStlHVvvWF0Xx5Lz9d 0xcYGlxu+1ZyE25p0GAhWXRkQnJ68mlJQO+6+cMfiYXWP0Sge2H1NjxGDdW1nK2VA+b+ iuzEE8fDB7sNbuuyNY8fY5CFKcHA/dB1gNuJZ8wTQ/jL+5Sk+SR3I+Btd1DV+i5oDArv 3Ujg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320803; x=1719925603; 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=k8CBQYgpPSbhoWM3/U9KW2bBBLwbvBk02G8XBXzJ5KI=; b=KBoPS8RptkMf2cpr7LhYPSp8Nc+ZfYawBaA3Zb9Ygxp5J6039wADYnYPuxxiXjZPcL RTJ4cKqr0Tuo5moF3EWUC21h+RP1e0BpkjxEG73CYnE4V5fpAjxY2ujkOOZIFM+BDc05 vDacZ1sEXsMIWTtbDdxRTTlhXESjvS78phenIfdQ4sQh2h1+gZGOIcR7LhtN1tzgulqK ROyNeNobWh276PHWd90ZEOdp5XWZ7N78Vc6fq6nFH4TupH53ub+PZVIDyLYy6f++hgd7 SBj2iYdZD3mN/tV+Cemiq7kaPuvjC7nno8GgZsMpuqQnV3RTZzv34G/OKoN09oT8vllg dIgw== X-Gm-Message-State: AOJu0YyJ0UG/QDSr4uSH8+BoIcP/Z7MfnBmrLry5U54LHFRajxMtkrYa Tc5ET3hQZp05+HrvXN4H5wFkkFdkxCu6jWxIfvHOkRDes2udlLhvtqEEdg== X-Google-Smtp-Source: AGHT+IEuxsQFux/lhjtSIB6EbP4rTAbosXJ62BV9V/nk9iyOtSbLVYD5NYObOQ17ogr5/i6JnUHnrw== X-Received: by 2002:a17:903:1cb:b0:1fa:3b97:c93d with SMTP id d9443c01a7336-1fa5e698394mr45490855ad.15.1719320803385; Tue, 25 Jun 2024 06:06:43 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/7] netdev: reuse NETDEV_EVENT_{AUTHENTICATING,ASSOCIATING} Date: Tue, 25 Jun 2024 06:06:20 -0700 Message-Id: <20240625130624.385553-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625130624.385553-1-prestwoj@gmail.com> References: <20240625130624.385553-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The authenticating event was not used anymore and the associating event use was questionable (after the CMD_CONNECT callback). No other modules actually utilize these events but they are useful for autotests. Move these events around to map 1:1 when the kernel sends the auth/assoc events. --- src/netdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index bada1ab5..153001ab 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -2422,10 +2422,6 @@ static void netdev_driver_connected(struct netdev *netdev) { netdev->connected = true; - if (netdev->event_filter) - netdev->event_filter(netdev, NETDEV_EVENT_ASSOCIATING, NULL, - netdev->user_data); - /* * We register the eapol state machine here, in case the PAE * socket receives EAPoL packets before the nl80211 socket @@ -2919,6 +2915,10 @@ static void netdev_authenticate_event(struct l_genl_msg *msg, return; } + if (netdev->event_filter) + netdev->event_filter(netdev, NETDEV_EVENT_AUTHENTICATING, + NULL, netdev->user_data); + /* * During Fast Transition we use the authenticate event to start the * reassociation step because the FTE necessary before we can build @@ -3040,6 +3040,10 @@ static void netdev_associate_event(struct l_genl_msg *msg, if (!netdev->connected || netdev->aborting) return; + if (netdev->event_filter) + netdev->event_filter(netdev, NETDEV_EVENT_ASSOCIATING, + NULL, netdev->user_data); + if (!netdev->ap && !netdev->in_ft) { netdev->associated = true; netdev->in_reassoc = false; From patchwork Tue Jun 25 13:06: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: 13711121 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0401F158D83 for ; Tue, 25 Jun 2024 13:06:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320807; cv=none; b=OVHt0XPHpL2GPF/PYFKvPKlrhNpAkDmUI4KmlY1qWMRXcjHN/8XMJtBboyfhNLgldoK06OUy65y8fffQ2ONr5T+ijEKKp03ok4wfNgnArXKcc9U+msoTrCpMKZvX/zdE02XiECa7ST9JPhOGYMUXr1JtTKe+l8TlnKYWQFeO+RI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320807; c=relaxed/simple; bh=mmDYjklFIcTpoXWV1x2wKiibrB1RgOqL5slrdzlkXfk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eH696CKkPCHH/Z2elPreCI4WXj+kn/GzQLIocqN2EbDTyKyj46QpEabxtlAPPa+ghZLXSZokWp885lq8Nqk6EBI7wULs6xOb18oREmA/m6NcWDjAs1COB1GMS2KcX8eDUKN9J1FH18VLrk0VeC33Hh+ogEHl+2cu0VmG08vCXfA= 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=Ii46frjy; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ii46frjy" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1fa78306796so2897505ad.3 for ; Tue, 25 Jun 2024 06:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320805; x=1719925605; 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=k7h9S36rr+40OVRYfR1Fp8I++VRUBzsZIRE2k7h2nxo=; b=Ii46frjynbOki8Mr6mV8lHpxLuy7uh9vtzvSBDgJMIQjd305eBWrdU8U16BtWdsPqF msAg0L651/zA9pF1q+YiXeKL3facfRcQ4BBd2v8KIbAQRm0KssMj9zoACEBHNe8LY02Y wf5R4UbbNWGW3IeR5oKqRiXoTBAiiBEjg4a6Q4Gd2zb8iustxxtC+v6E72gcRDV18bOY IgqUn1OA4G0ExND33khd/yiXMuuAWlf3wbwGJ6t96pa9E6rjioIHF+qQvYlsPSP43Arp WHFGVIGnpZBBYin6Hg/tDBNPHGDu5Po43Cfi10t8AV5P2s4tUNOI4tJq/xHkOIzXjU9U sn1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320805; x=1719925605; 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=k7h9S36rr+40OVRYfR1Fp8I++VRUBzsZIRE2k7h2nxo=; b=LkhxF3MRxKmJGGhJFg3UAT9gL+04514k4xq0PPsuPR6rhM6nf+wgzXPTfaRZAU22ik HFhcdhqfKM/z3U1OvCLYw0IL2Iv1yYMWX/8zimSqzTk+5wSA1IgxeAgJG77d0pxb7TaJ kcbxJfq6Z4P2XgqMQcqxisojWF4yVeCYDgEPYKLe/N4YcCnEU84gq4z/vNAuZrOgr7aP B6aef69Z5Peyxrfny4Cno1c87kpCAIJGiodf3dvOb1yiz6l6PTHpC4Y+1P4brZNvUvD1 sQfJBz5/YV5D7m3JiwR1mObrEPvCR9AgHW1nTHfVhtxNNmVMKhkrtvgmPPMe+r7f0S6T Vl4Q== X-Gm-Message-State: AOJu0Yzu+qoQVzDXprgp4TxqQvXldiM//lUfMPgsUgcr9S2X95BaywYJ XDSfxqmmKZVfOTW3OZPykK0R4fXV+pVKTgZZvUg4SkRBY1T/o2SNQVW+AA== X-Google-Smtp-Source: AGHT+IG2//kHF0/MYl0n+4H78cDjp6vOF7l4bZ5Hl1qnXRtYTasW5i73W/RxDeUCJ/FBNZqL7lwGgw== X-Received: by 2002:a17:902:d50b:b0:1f8:67e4:3979 with SMTP id d9443c01a7336-1fa1d6533bcmr102004525ad.47.1719320804847; Tue, 25 Jun 2024 06:06:44 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:44 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/7] station: add auth/assoc debug events Date: Tue, 25 Jun 2024 06:06:21 -0700 Message-Id: <20240625130624.385553-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625130624.385553-1-prestwoj@gmail.com> References: <20240625130624.385553-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 These will be useful to trigger behavior around authentication and association. --- src/station.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/station.c b/src/station.c index 2e5febee..1e8846b4 100644 --- a/src/station.c +++ b/src/station.c @@ -3486,10 +3486,10 @@ static void station_netdev_event(struct netdev *netdev, enum netdev_event event, switch (event) { case NETDEV_EVENT_AUTHENTICATING: - l_debug("Authenticating"); + station_debug_event(station, "authenticating"); break; case NETDEV_EVENT_ASSOCIATING: - l_debug("Associating"); + station_debug_event(station, "associating"); break; case NETDEV_EVENT_DISCONNECT_BY_AP: case NETDEV_EVENT_DISCONNECT_BY_SME: From patchwork Tue Jun 25 13:06: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: 13711122 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 46FFE1DFC5 for ; Tue, 25 Jun 2024 13:06:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320808; cv=none; b=C7PcKxw9j9lQpJhZK8ZV1bEYZ7ZFaKqC/TcuJCu9rOF/dXiXXBYFcsb+xIR7L712LiShRX+Ldq38kCAETclid2cWxhALl7Es9J/lJNReUQKXPBsTOaaRNc4TekefbtItt615/qk1kJB2iBOs801P1NdzXNdATerQT7UIbjAcpPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320808; c=relaxed/simple; bh=RNJXjzn7dfvacAcjbQC8RuzQ87USHkYfXo8CCOV5pPs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M4hHGRdbANQJmUzH4SBI8mnpgWbxF90GJIsZ3I9zGC7VM1X50IFcpWpe1tVY82rB+w27GoY65rg5fFDf1gV6zK5SI06+oWLxB/hC1SDKYpFPWLhmt0d5QDRzhrE12DysIfkyRtYh13vSW+y4ri+fCYMS0f9y/+Lob/JbFpEBc3M= 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=hUS524SS; arc=none smtp.client-ip=209.85.214.175 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="hUS524SS" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1fa75f53f42so3333795ad.0 for ; Tue, 25 Jun 2024 06:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320806; x=1719925606; 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=polICqSFyqeZxpJiwecS0KeD3RJtwMewp3OOYZGgrSg=; b=hUS524SSMyZ9oIg6cJj75h6orSLHcQcR6lJKVSonP/4A6PdF7aYeNIpoPpoFb99G5F rr+Z8eBVVB2/ZEHxroXJ39atQIc3j7vjKtJqFNjKLoo/+SZlDPo6KfDar5/N/HC/r27F g4Hob5qIhhMIAPfKZBiB2RHeWSucZTJCmdQ2rzOAUDFRPwM3vw/QMOmDDtfGUcT/PzIo SEOdo6UOZ+s440TqzvPIprnFYBY8On5XnztzMx286+5iIvAuBbTw3Ut8JxUF1WH2AXa5 KNn3YXWzNma1jCpfPYiqxOwQOjBKy+e3MV173iGIltgWd8WX8VuqZltq8arp9rjvEvwa VelA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320806; x=1719925606; 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=polICqSFyqeZxpJiwecS0KeD3RJtwMewp3OOYZGgrSg=; b=Sdy5QCevQY0opsToTM6+1mSob5fwiSuZ6T3rp7vlz3kbZk9N0wGPqynDKXxDxe9K6A eG0YacPzU42iVDcP+Gx+8Sql5jBY0FIzsaB8T9wCJCVU+d91SvtX+uDxAs/9Lw9UWY0M BQHBrCX+/nP+20gim3LFOGdzrX8Vxwd04BGGFhpbMlgwNxWAWLGCpqE7a6o2Sh3YpQ3V 6nqK8Px69GpHRVRgUYHriJxhvzTv7HuYGZo81k+nxmua/mX4TWFizV+FhtoZepfbouft XqNWtMoCV7kPyuuke+rN2mLNaDTg5nmaRFlC0B/Aw9gXnDIkzgByBvaJAZGuf7AkFixr 1QyA== X-Gm-Message-State: AOJu0Yyb0af9ZI5RmEosuNr/cPuvEyVFlQIf+o3AFBjlt78kvBNdNOFs uRcBxKweqAIsmB5zmZb/Ex3FWzUdjJtFtxSCBSiCnccprqKuZdH1LHeWvg== X-Google-Smtp-Source: AGHT+IGZBbIEP5mVQakchNe4tzonQ54IymCwdUnMFiSW+Fp43bpgHgJEcedF92oCtemx15Olw6jplQ== X-Received: by 2002:a17:903:2342:b0:1f6:ff48:1cdb with SMTP id d9443c01a7336-1fa2408231emr80828165ad.52.1719320806291; Tue, 25 Jun 2024 06:06:46 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:45 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/7] auto-t: add test for deauth after authentication Date: Tue, 25 Jun 2024 06:06:22 -0700 Message-Id: <20240625130624.385553-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625130624.385553-1-prestwoj@gmail.com> References: <20240625130624.385553-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This code path is not exercised in the autotest but commonly does happen in the real world. There is no associated bug with this, but its helpful to have this event triggered in case something got introduced in the future. --- autotests/testWPA2/failure_test.py | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/autotests/testWPA2/failure_test.py b/autotests/testWPA2/failure_test.py index 61cf6ade..c8ecb33c 100644 --- a/autotests/testWPA2/failure_test.py +++ b/autotests/testWPA2/failure_test.py @@ -8,11 +8,12 @@ import iwd from iwd import IWD from iwd import PSKAgent from iwd import NetworkType +from hostapd import HostapdCLI import testutil class Test(unittest.TestCase): - def test_connection_success(self): + def test_incorrect_password(self): wd = IWD(True) psk_agent = PSKAgent("InvalidPassword") @@ -34,6 +35,35 @@ class Test(unittest.TestCase): wd.unregister_psk_agent(psk_agent) + def test_deauth_after_connection(self): + wd = IWD(True) + hostapd = HostapdCLI(config="ssidWPA2.conf") + + psk_agent = PSKAgent("secret123") + wd.register_psk_agent(psk_agent) + + devices = wd.list_devices(1) + self.assertIsNotNone(devices) + device = devices[0] + + ordered_network = device.get_ordered_network('ssidWPA2') + + self.assertEqual(ordered_network.type, NetworkType.psk) + + condition = 'not obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + ordered_network.network_object.connect(wait=False) + + device.wait_for_event("authenticating") + + # Trigger a deauth just after authenticating + hostapd.deauthenticate(device.address) + + device.wait_for_event("disconnected") + + wd.unregister_psk_agent(psk_agent) + @classmethod def setUpClass(cls): pass From patchwork Tue Jun 25 13:06: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: 13711123 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.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 94B291482F8 for ; Tue, 25 Jun 2024 13:06:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320809; cv=none; b=V9+uStsPyOevcnYtaoW88B9OJMPB558N4TLwYFVgpu/xsCBpr862/SEzW8dvx3uaGy+wk8TCFJs5wO5lU9HrVQHnlgzhLWEQReG7G7wS0UT5BSycZGNiKDRaEkmrGzH+yOhyK6foK1vFZUHRtmhEQ4XQqFzKxT7hHVaYX3+vtZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320809; c=relaxed/simple; bh=2/YIDZntCC+bKNXCrqR05azYPO5cmwgfNe7FvsobFVw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E2vkAypDVoOhWu9Fu6IiZ/Hh3r51E0XhdXE10atYhgK/zJZIvSje/NVScz/0NsZMuJMXrd3bozvIPJnfqVP4NOMGG4rLOu/yYEMwoR/ztDCwVzEDz/ALGu2W9oSlYKrgZcy0CZ8y2PiC6taLp+qAxMtJrP733KX756F2vD9V0b8= 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=CNFQfYun; arc=none smtp.client-ip=209.85.214.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="CNFQfYun" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1f4c7b022f8so47480985ad.1 for ; Tue, 25 Jun 2024 06:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320808; x=1719925608; 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=lXiAgG1s+6d04RN5hd5w1iSdbqu45wAyYTOnPDQxZyM=; b=CNFQfYun457D62Xaosia29Ojgy6vdvAYkDCKD+QzOwODm+HPzOaM0jy8aJcxuEW+ed x84n/JYvaEFhSM8axWs/qnZVKkYOpUgGBWikD6RU/b7kJj3bwQUMwvU1Ey5uU91ufe5C ZjlD09yeTQLh6VjwkfL5SMwH9tqmbZpG5izJ36H4xFcJ27mOW69odQOCOvGXnN/BPCum 0l+b7KrOeFOcL3wwCcOrVg9LjlEAdqodOF88VGzrkFxD8/p5jcZjEHTFhvThcmlDKnix uvjw0+UXQAL1afwKZM4ERNZiQ9P0YX566TQn6NokiETa6lM0wnk74KNVjxuRv3X6r5I9 Hr2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320808; x=1719925608; 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=lXiAgG1s+6d04RN5hd5w1iSdbqu45wAyYTOnPDQxZyM=; b=aVEdZGOlHebhbfzwhVfrdNvP6uGCjzeWwCdWzLNBzXHuuUI7LrnM4m1xXE7yT+L21U qpC07W+nK0sGnTgcIeNIaTVW3+ODfoGPqKeaLVrPIsXYfpCLeN3qVP7vXDqMlL9enaPU eH7MD7/8S/ja64cOVmBrL5p38aNQSTuJpuaxwrwA7usi01kabEjkv7sEigjgI1xGg6EG bjTPRoe9YCWIau9yZRDg5ar7w8Vv6QbezWVzNJmXqfLCOItCTDzdame0qjr1tgwXpPXH vcis4TqRHjRttXJD7Pv555SUt4Qhs/ST98qceTkV0kPlArivMxmVVL+a3Cm5cXqXukRZ mLHA== X-Gm-Message-State: AOJu0Ywk+WvRUKJH6qDF55E8sMD4qwlELEuuiuHL+HgmvCTXGgTf72U9 VcIE7W6Y9qtSzqKixsVF1mj0sl0QcGnp5arWYOiKHiLVDvJPiwY6OR2A8Q== X-Google-Smtp-Source: AGHT+IF07DgU+eGZOmeyHUxDD5bmEv2fPPScoNGsjqPISdJ17zkYNgZ1CSzIpkb7qH7jXCZ0/5sVtQ== X-Received: by 2002:a17:902:e846:b0:1fa:4b9:d002 with SMTP id d9443c01a7336-1fa23bdf6c0mr98149675ad.23.1719320807714; Tue, 25 Jun 2024 06:06:47 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:47 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 6/7] station: add debug event prior to sending an FT-auth frame Date: Tue, 25 Jun 2024 06:06:23 -0700 Message-Id: <20240625130624.385553-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625130624.385553-1-prestwoj@gmail.com> References: <20240625130624.385553-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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/station.c b/src/station.c index 1e8846b4..509d919c 100644 --- a/src/station.c +++ b/src/station.c @@ -2449,6 +2449,8 @@ static bool station_fast_transition(struct station *station, goto done; } + station_debug_event(station, "ft-authenticating"); + if (station->connected_bss->frequency == bss->frequency) { ft_authenticate_onchannel(netdev_get_ifindex(station->netdev), bss); From patchwork Tue Jun 25 13:06: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: 13711124 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 3CD581482F8 for ; Tue, 25 Jun 2024 13:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320811; cv=none; b=joieuL8nuZyj+L72ASant5dsHMEvYS/CPyOLczutzw3TWz7gUwr4IpSNTKf0cK5SVpRFfQbbtbcf6BKh1I+2hI3tPTZosD7AsA8WSpEWJzYxPgH85MzQP1kpdzbSdWn8UrI0HeKOeDxkFO3g5GUDrQqR/GghqvMm/BgJHoFiQ7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719320811; c=relaxed/simple; bh=aN0GS/eB6all4xDAa/Tzsg3Zwk60lecIW4QrPGFpgU4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YyakUWZpYtafJ72fnxi0bbmME5zUZzEAumDFonzDH8USre3YyZqHhsN3MXkVcEaPpjzikbb1ByxIeSfztLE5RYPR2bHIE2jRmAJHSnzpeWwiKMTeuiEPP5d0TFmuRt6QvaBmFcfrsCtuAXq73hVkBPZSFMEj3fZqpRambJo3qSs= 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=jqhApJwB; arc=none smtp.client-ip=209.85.214.177 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="jqhApJwB" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f480624d10so45291815ad.1 for ; Tue, 25 Jun 2024 06:06:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719320809; x=1719925609; 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=s+FQS0cnw/y+Ndkc1EwDfHBGbMpY9IQFB0Xs/Fy5F6g=; b=jqhApJwBBQx3IJHNsNxvCy1uUsI84KsQ1pevEIywhYLq692YMTMoA0PhpMVq7avNuq nlTK2lOAljiyVdGGS8bZWVAPQFVsnqrur0EMUbmequZjvedjfjeNuq5/c+Nt+szDwUcy YJ0ow32DBPaDvE74lZPHufkSGZHcZyVp1IK2cPyCIgjjCpWMPgyH5YVFcIaQFbPLatwH LeOFfce5zkpAYj9K+iJKXnsIOORJ7MShh6UvI7qPSCr4aIR/2hu7PNOY3Tk+fovTF1x0 SsX7et36RcJVtK2Ol1cEnBi7lH9j0YrURWvjwn4fHuboisfyOndH0bAGzj5Qcmule9Td X04A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719320809; x=1719925609; 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=s+FQS0cnw/y+Ndkc1EwDfHBGbMpY9IQFB0Xs/Fy5F6g=; b=ULaWwjrZSFrKW+UVluteqrzO3zqtBjydgU28E9OgG3kglEUoKcrXm5O9Bou5hnD9Q0 ExIHu/CY/UIdhnrLkk/XdOgZejOoZLrkimtoi99XWSI1x1/0Kja0zHpOUnzctlOwPcEK 0TUFhTGGuZO/G9irLjPC85yO8o2ZEv3tNFZGRJr4olfBxuWYZ+UInePfBOTxUFy5c+2Y 3OmC09McSzm3SsQEgcLpB+gCT8GmMMV77v2RylsXBVMIr/kBJ+Md1cVEMQhMyii9ieDe gyJsHabnH8ztcZHZooknY+OGvnU81FJH9sJm9fNdvCY27UiYTatvgF0Hr/PmRm5YOA42 pEeA== X-Gm-Message-State: AOJu0YyFmkUZlTHLZs7wqhO/dxdKKqXOKygOaU7C1+e4XstZJxEyW3Za XjTuhAddxd9ghjHOQeFaSlhX8aVpo01TeaX0rZkDRlCiupCn8FU2FIfUug== X-Google-Smtp-Source: AGHT+IExavZECHWpnL2VAZHYWaujwKouRridi4Izh6e2CHzGb6U7Iqt+PM1eLbtk4q797DUc73PVaw== X-Received: by 2002:a17:903:18d:b0:1f9:aa05:878f with SMTP id d9443c01a7336-1fa1c7f72fcmr108709615ad.0.1719320809166; Tue, 25 Jun 2024 06:06:49 -0700 (PDT) Received: from LOCLAP699.localdomain ([208.195.13.130]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb3d5bf2sm80778305ad.189.2024.06.25.06.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 06:06:48 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 7/7] auto-t: add test for a deauth coming in during an FT-roam Date: Tue, 25 Jun 2024 06:06:24 -0700 Message-Id: <20240625130624.385553-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240625130624.385553-1-prestwoj@gmail.com> References: <20240625130624.385553-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- autotests/testPSK-roam/failed_roam_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autotests/testPSK-roam/failed_roam_test.py b/autotests/testPSK-roam/failed_roam_test.py index 8cce8bb5..60bcf366 100644 --- a/autotests/testPSK-roam/failed_roam_test.py +++ b/autotests/testPSK-roam/failed_roam_test.py @@ -149,6 +149,21 @@ class Test(unittest.TestCase): condition = 'obj.state == DeviceState.disconnected' self.wd.wait_for_object_condition(device, condition) + def test_ft_deauth_before_association(self): + self.rule2.enabled = True + self.rule3.enabled = True + + device = self.wd.list_devices(1)[0] + + self.connect(self.wd, device, self.bss_hostapd[0]) + + device.wait_for_event('ft-authenticating', timeout=60) + + self.bss_hostapd[1].deauthenticate(device.address) + + condition = 'obj.state == DeviceState.disconnected' + self.wd.wait_for_object_condition(device, condition) + def setUp(self): self.wd = IWD(True)