From patchwork Fri Jun 24 23:07:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895158 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 BE96946B7 for ; Fri, 24 Jun 2022 23:09:54 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so4148001pjz.1 for ; Fri, 24 Jun 2022 16:09:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4ZzlOpSGZ27RBtGg/CurunhAG1/LCTLedRPaMpLqxQ0=; b=WZtsIpTcfK0/8rKAjPEsq81lMPxYDoBUTLs3w/nMvoDOjAG/GlvZECHcYz85sroXFW sPOC9Wm/hQ9GQxgt29E4PH4iHoBs6r9COmudBjAIZzzJg5K47FhXULcdBteCLI0M0kxr 10AAJUzVw4wKsCtV7DGkM3Y50jQ6iWEBxl2SvzB4g0uY7CAhjhZL2w0n2nU1oaHZDuN9 TsEvmuZIJHt+a3FvlcdUOL2/tHzwPJgDqHE3TNsggbkQxiH4ic314qIYJEI9AkvzvRC7 Xc9JI1qvZWN9Vslk2vrM9I5TaUwnMa3vuHFf8ggBo0xLJ+0JbJW7Vn00P2fy3z9Q5suA 5Wbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4ZzlOpSGZ27RBtGg/CurunhAG1/LCTLedRPaMpLqxQ0=; b=OA4V8AKJDTp+9gjQiX7Bh0JsU9/DG7nmahgz9foB6h5wedq/lA/pSTGxPq+3Ua+gVV zeykRr/UP147BRkDuKS7Z3a4heN5aPzOHdT+zPIK4lW6aiVlkdbCfg0XK1S1DEe+Ve9W uabrfw4Ncim04mCZxGjHOWfBcF0uFOtb52vPEjJsVxhFxzeiKjXKm0nKRrQl51R0eT1h kQUdWVRfWZsH6XSjA8pBmCRGthJaSFf+BKSmq4/SgdfKKVwDfy8XK7qhThJAjjESz3LY wy36ZsUvCoBNwtIvQUmwBjFcR0uyR1dXFZzEpI7xSPCCfbvLNQIXIfiFKglxQ1YAoiwT pPrA== X-Gm-Message-State: AJIora/3Np/VwAQ0P2QFIs7Baf2EE7LrFpnP6vjMj+cPQDErS3yiSPWo eexoMMEy3kKnHOkvTgXMG5dCR6jBBXo= X-Google-Smtp-Source: AGRyM1soJyv235pT6mso+P9xCC8E5Obd/wR72CtFH7AJhnTGGncTLrJ2uooNaxT9E8FTUD8zQz4xeg== X-Received: by 2002:a17:90b:3b41:b0:1ed:25b1:e53a with SMTP id ot1-20020a17090b3b4100b001ed25b1e53amr6274810pjb.71.1656112193827; Fri, 24 Jun 2022 16:09:53 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:53 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/8] test-runner: remove reference to missing class member Date: Fri, 24 Jun 2022 16:07:34 -0700 Message-Id: <20220624230741.1957863-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 The print statement was referencing self.name, which doesn't exist. Use self.args[0] instead. --- tools/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/utils.py b/tools/utils.py index 66002f77..857aa1eb 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -259,7 +259,7 @@ class Process(subprocess.Popen): try: self.wait(timeout=15) except: - print("Process %s did not complete in 15 seconds!" % self.name) + print("Process %s did not complete in 15 seconds!" % self.args[0]) super().kill() self._cleanup() From patchwork Fri Jun 24 23:07:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895159 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 AE84646B8 for ; Fri, 24 Jun 2022 23:09:55 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id t3-20020a17090a510300b001ea87ef9a3dso4117736pjh.4 for ; Fri, 24 Jun 2022 16:09:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cBV4hQEgPqKcyinKv7psJB0197D8SzSiAL8wt3qxwKE=; b=g2RhhkE0+XQjgM1j78vsECIZJDnnNsGcQIEC+R4c6loUYCyg1v39vWzlT6GQQ/WbcA 3WeiO2GgueAGNW0AUAWbn1PYDJINzH4MMlBlLCG4hRMBf/AA9saaif4fMC8um3wT1vNu XegbtNlrUTDWUrcQmGhWTARQR6Xltiy5JOCfVShGyo9iu80sqt9wkxDYTahKlRYqUF83 bNHJoVWvmqRfTpFl1lmNautkY/kehdfDtKCyM8UOrNRSpQMYT8E2BddYfhWe9p9Qnwfa lI3OBrawpNAQ8mSmddxQfEJzgQhKip7C8dZXw1w9KV2c7cvRORap8ue2sRObFUvYkW3I /dcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cBV4hQEgPqKcyinKv7psJB0197D8SzSiAL8wt3qxwKE=; b=5rGUJTaWHH5f9aoYzYIQUWUag1oJin0wO/nU1HYWkz9UY5JWEX3fkckisZ7eCVUdIM f8YvB+kaZbHgdV4iYilXo711bT0RBibgJkuJN1wDztDNpmY+oMbf6QEvKClhy0EWbCSq F86N/sfgXh2v+lr6zs+nCJLMXc16S7AEMpiLLhWQw6tgB1dvg95Pwq3xYnDA+W5SJL7X 2/Ni6MrbGqFby7v/VQFY1BY/yTBkTPq9gz3KUHb4xTdfekJKS3F0v05xpH3pagAcfD7R aJdk6oi3pmLotyK7hcmK8qkTYakmthfc3V9EfJT5w78fWgCJ5DqPwIVhtSvvOygLhjY5 ldHg== X-Gm-Message-State: AJIora+zvPRnBIjWr0PXUiJSGlnuUaMEi0RUC5m/LWSEnJmEqmJShtuz KswZcHO2zwmvPjqsK7O0ez2rprX2pn4= X-Google-Smtp-Source: AGRyM1tFgWwGpno6OmXvDzWxFWzyvLgNbre0e4zMVrDP1xfEjai+JCDnab0j3XyGhflJjUCqIKQtsA== X-Received: by 2002:a17:90a:f991:b0:1ec:92c0:595 with SMTP id cq17-20020a17090af99100b001ec92c00595mr1347815pjb.145.1656112194881; Fri, 24 Jun 2022 16:09:54 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:54 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/8] test-runner: make is_process_running more accurate Date: Fri, 24 Jun 2022 16:07:35 -0700 Message-Id: <20220624230741.1957863-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This function was checking if the process object exists, which can persist long after a process is killed, or dies unexpectedly. Check that the actual PID exists by sending signal 0. --- tools/utils.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/utils.py b/tools/utils.py index 857aa1eb..7272c1f9 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -342,10 +342,24 @@ class Namespace: def stop_process(self, p, force=False): p.kill(force) + def _is_running(self, pid): + try: + os.kill(pid, 0) + except OSError: + return False + + return True + def is_process_running(self, process): for p in Process.get_all(): - if p.namespace == self.name and p.args[0] == process: - return True + # Namespace processes are actually started by 'ip' where + # the actual process name is at index 4 of the arguments. + idx = 0 if not p.namespace else 4 + + if p.namespace == self.name and p.args[idx] == process: + # The process object exists, but make sure its + # actually running. + return self._is_running(p.pid) return False def _cleanup_dbus(self): From patchwork Fri Jun 24 23:07:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895160 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.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 62BAD46B7 for ; Fri, 24 Jun 2022 23:09:56 +0000 (UTC) Received: by mail-pf1-f171.google.com with SMTP id 128so3733762pfv.12 for ; Fri, 24 Jun 2022 16:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vL0Nb2ytaedeC/42KgKCrIPvf7+iIShRCjksTpLYMcM=; b=lE3+uZuVFKTphC59VdL2xpuecI6lWpDffKmGLlZ+5KE9fXGkVtruwHRtMIGclptlcL mh4PKgJKAtv8XozDRVgaRF2vOFX8oa6DXiqMlzaD30H37cjhHYtbsU/km4heknZ08U1i FQVAIWEVOn9ukMFL3mGwUt+ZX5mAUhwWSsmqcl1FrCBO+qNVKb+639Nd6yA1RFy23Qru Nx78kLHg3qHUXk0rdxJzqW6LfD9x/u/Sc60QvL6SNUAgy7HXwL0cYAG48GEcjrG33Hn5 2+03SAxkRO6La3NDb3KQ08nwnLXzaLyiYdX3Q7v12VKbVmPHEOQPMUS6xhG78sd9mvrF VL6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vL0Nb2ytaedeC/42KgKCrIPvf7+iIShRCjksTpLYMcM=; b=pEeWI7A8XPqL6DYRQkIgH+Z7gMSUmD7/81xN2qLPSoavqa2ETt1yej2GA4AeCKAX0f LLJ0j/nbD2mAKY/ZZZeJbSZFd3DYSBhagAlJCUJwu65OgF1nJNM0c3qPaJeJ/Iigj6It 2AaXdidIltG100dT/nf6NnbxEnTyB5FtbqIeVPt4uf0SSsnt7N5+7t/yXH8GMizPGxAv OnGinn15pkxLAOJbFvwkr70/ti+mNhDEFlNM5qDpNkhkC1GCkwDqKYUR57qbBs5txob6 TCLRxnUJwH/VoFg0OjlmvJKc+xdZku9LZitpZIUUCMLtmb/1oG27VTeD0OndcFCATcPs 1QRw== X-Gm-Message-State: AJIora8191bNlfNb7hlucK6Zr37zuTxKJf2718XlqW+CZnTQMu/Jf7XG oPw3jJnaU2964CNO7KXFXV3BXN6c+7w= X-Google-Smtp-Source: AGRyM1tHeJEc80AuFMk+DtwPOnNbjS1RInCbdBKiR1z63lWrARCNcAiyg4r9VZUcgCCGfmKXb2xA8A== X-Received: by 2002:a05:6a00:17a8:b0:525:537a:b0df with SMTP id s40-20020a056a0017a800b00525537ab0dfmr1473977pfg.71.1656112195607; Fri, 24 Jun 2022 16:09:55 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:55 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/8] test-runner: fix UML blocking on wait_for_socket/service Date: Fri, 24 Jun 2022 16:07:36 -0700 Message-Id: <20220624230741.1957863-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In UML if any process dies while test-runner is waiting for the DBus service or some socket to be available it will block forever. This is due to the way the non_block_wait works. Its not optimal but it essentially polls over some input function until the conditions are met. And, depending on the input function, this can cause UML to hang since it never has a chance to go idle and advance the time clock. This can be fixed, at least for services/sockets, by sleeping in the input function allowing time to pass. This will then allow test-runner to bail out with an exception. This patch adds a new wait_for_service function which handles this automatically, and wait_for_socket was refactored to behave similarly. --- autotests/util/iwd.py | 3 --- tools/run-tests | 5 ++--- tools/utils.py | 26 ++++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index f609e37e..aae57733 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -1097,9 +1097,6 @@ class IWD(AsyncOpAbstract): self._iwd_proc = self.namespace.start_iwd(iwd_config_dir, iwd_storage_dir) - ctx.non_block_wait(self._bus.name_has_owner, 20, IWD_SERVICE, - exception=TimeoutError('IWD has failed to start')) - self._devices = DeviceList(self) # Weak to make sure the test's reference to @self is the only counted diff --git a/tools/run-tests b/tools/run-tests index 2b3b1f2e..565847df 100755 --- a/tools/run-tests +++ b/tools/run-tests @@ -326,9 +326,8 @@ class TestContext(Namespace): # register hwsim as medium args.extend(['--no-register']) - self.start_process(args) - self.non_block_wait(self._bus.name_has_owner, 20, 'net.connman.hwsim', - exception=TimeoutError('net.connman.hwsim did not appear')) + proc = self.start_process(args) + proc.wait_for_service(self, 'net.connman.hwsim', 20) for i in range(nradios): name = 'rad%u' % i diff --git a/tools/utils.py b/tools/utils.py index 7272c1f9..f3e12a85 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -9,6 +9,7 @@ import dbus from gi.repository import GLib from weakref import WeakValueDictionary from re import fullmatch +from time import sleep from runner import RunnerCoreArgParse @@ -213,7 +214,24 @@ class Process(subprocess.Popen): self.write_fds.append(f) def wait_for_socket(self, socket, wait): - Namespace.non_block_wait(os.path.exists, wait, socket) + def _wait(socket): + if not os.path.exists(socket): + sleep(0.1) + return False + return True + + Namespace.non_block_wait(_wait, wait, socket, + exception=Exception("Timed out waiting for %s" % socket)) + + def wait_for_service(self, ns, service, wait): + def _wait(ns, service): + if not ns._bus.name_has_owner(service): + sleep(0.1) + return False + return True + + Namespace.non_block_wait(_wait, wait, ns, service, + exception=Exception("Timed out waiting for %s" % service)) # Wait for both process termination and HUP signal def __wait(self, timeout): @@ -423,7 +441,11 @@ class Namespace: if Process.is_verbose('iwd-rtnl'): env['IWD_RTNL_DEBUG'] = '1' - return self.start_process(args, env=env) + proc = self.start_process(args, env=env) + + proc.wait_for_service(self, 'net.connman.iwd', 20) + + return proc @staticmethod def non_block_wait(func, timeout, *args, exception=True): From patchwork Fri Jun 24 23:07:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895161 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.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 5135346B8 for ; Fri, 24 Jun 2022 23:09:57 +0000 (UTC) Received: by mail-pf1-f182.google.com with SMTP id 65so3728474pfw.11 for ; Fri, 24 Jun 2022 16:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o/kXefAtho8jfxO7eiKKlDAV+3NVY1UBpBGDU8pZOKM=; b=DS6h3sZ/vDP65fF5NC9ZLvJ3xPQpWi19RMZWun8PUEGBexBL5BK5taoQBqrNl8HBJa t7jnqv6T9PUlpuHMlNQDfBCfhzS45vTwrYNXIBbUoXhGnNaw79P0Qv3Y4qnJrJRAAWVV AF9WlpL5jzYpSzp08126P+xEnVCHdqVek8dyu+2gep+EZVNFpus8/KrIKAsBDqPEO47n WzQh/jBTpgh1aUn0qHHZ57VJ7hwFUQf56JAP1YfFmeQ5yUz0LLiUeY598adXd8RURkUf qoM9tXWWRf4Q3Usx/79BdXQ1hmPoTEqbUiWZP37PkZWUaUcOs2nkn2OYe7dkfhI1Fdzv opdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o/kXefAtho8jfxO7eiKKlDAV+3NVY1UBpBGDU8pZOKM=; b=GwtXssBjadRmnKrQYTTSl3n8UiJuYD17joWTzuk+qfKTdU42cgGmgO7cDPV+OfYyEV FnukPut/9MnJ7P+2dASQmXr31aqEB2CmSOubtOqKSZ5MX9E/pqKtKC9IRIMh0kT3c6Gc GPF8aEHA7SgsMAq2aM9wWKyf067psQa/YLiVyxNAY6MRbnALpMbZ3sW1Hx8bF0/5EZDX ZATwLfYVc5eXxopR4HX7qhv+BQgRgf24rRaz3n5Z8HBonSDCjthBurK0DH2xMUc2NB9Z 0RjwhG4pClVvehIyVffOZ+a16s7Rhc76wQkH9uW5OnpjA7PWbk5XE2IRKyUyku5Rwfbk uLYg== X-Gm-Message-State: AJIora9GM2siNzeRhWOr2Rx2YQ+pGbUZd9MLjzwEgcciwitAxiditNnb 5fza7U9fYysJDHaTaegqVzFdmB4HwN4= X-Google-Smtp-Source: AGRyM1vjnxmvza0YPBO4pgpxbY1w5io3bdqH3b47j3jrdOuRhDMugbJVCu6/+r6bgv4K4QZJqyOt5A== X-Received: by 2002:a62:6410:0:b0:4f3:9654:266d with SMTP id y16-20020a626410000000b004f39654266dmr1499602pfb.59.1656112196551; Fri, 24 Jun 2022 16:09:56 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:56 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/8] auto-t: fix testEncryptedProfiles mtime check Date: Fri, 24 Jun 2022 16:07:37 -0700 Message-Id: <20220624230741.1957863-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Yet another weird UML quirk. The intent of this tests was to ensure the profile gets encrypted, and to check this both the mtime and contents of the profile were checked. But under UML the profile is copied, IWD started, and the profile is encrypted all without any time passing. The (same) mtime was then updated without any changes which fails the mtime check. This puts a sleep after copying the profile to ensure the system time differs once IWD encrypts the profile. --- autotests/testEncryptedProfiles/connection_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autotests/testEncryptedProfiles/connection_test.py b/autotests/testEncryptedProfiles/connection_test.py index 2b846596..ab5a0ae7 100644 --- a/autotests/testEncryptedProfiles/connection_test.py +++ b/autotests/testEncryptedProfiles/connection_test.py @@ -6,6 +6,7 @@ import sys sys.path.append('../util') import iwd import os +from time import sleep from iwd import IWD from iwd import NetworkType from iwd import PSKAgent @@ -48,6 +49,8 @@ class Test(unittest.TestCase): mtime = os.path.getmtime('/tmp/iwd/' + 'ssidCCMP.psk') self.assertFalse(self.profile_is_encrypted('ssidCCMP.psk')) + sleep(1) + wd = IWD(True) # Make sure profile was accepted From patchwork Fri Jun 24 23:07:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895162 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.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 264A546B7 for ; Fri, 24 Jun 2022 23:09:58 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id h192so3703882pgc.4 for ; Fri, 24 Jun 2022 16:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zkoFoVF8waPjoXpAaLeb6i2HYuOWVxZiXzl1f1mb8mE=; b=ZBn1RW+IfkhFWzREuCDVZf5BfNlImuAyN094r0MAokpr36CVUgAZdGVpV1HcRFtdS+ 9JVNBVfLzGCpV9BnLazJbOlNcNIpubsrmU7B1mF8MLAskn2FXpHBIJH8wSgpKfNIL/F7 KqAuviRh/yg3rhzBHBb/zImEdNK8wZGdMNPm8tgag4YxOt6iHKmnTbNecKdgI5Cv+hg7 h5iJ17bzgRKgtr4V3p2nf0HkjwMaSDqC/0BA1vf4TtUKxHGVTmBjvV8bcgN3SH9D2csZ Fe+121QMB/QFjSiQ90J7LUK+/nugUzK+n7uSn0Rtry3ETobV+b+O4Pl6hSkVokwfj7h+ h1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zkoFoVF8waPjoXpAaLeb6i2HYuOWVxZiXzl1f1mb8mE=; b=nXAuknavx/DuOw7pFk5ftpbO+c9JWVXwKOWNaa/4PjHPMyGDLN84j150Ba1YO/krR7 s4FYvjO9j7feAyQH59LtfVRWFyRU3s/M9wQZ/FOCSZ6oAAaA3DAeYRPNfZrdjCm0S2tD vvvZ614oPOCIeFJQydreL2ly7M4s0DUaqerGwqfEY05ycfhZdS32gImdU2H5SOkTcTIT Yszpt3UdxAkYuYcJdOwHJy9RpqcYtpF7JytnLwty/IxGz3Sg8hwM45B1QJEI4u50VGW4 cZrjpjTS4hbSephr7j77fhAsuco8HKCBKTKr7f8JEEVg4QA7yW77IpcHqYU/aWbHmecC Tf4Q== X-Gm-Message-State: AJIora/4kPwnzK8IjiiXODiZox/KV1uRmws1eOERxjTmj4T3wMySqPRj y5+6HsdnUjhOUxMdCWJhcSNVxgSyyew= X-Google-Smtp-Source: AGRyM1s3IZKzBWyLRKpW73lqsbSS/xGcwsJug+BgBjyBRTWxCp45oVntqJdQZOehfI2sHPow63cQrA== X-Received: by 2002:a63:2160:0:b0:3fc:b8ac:1976 with SMTP id s32-20020a632160000000b003fcb8ac1976mr1037669pgm.453.1656112197297; Fri, 24 Jun 2022 16:09:57 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:56 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/8] auto-t: fix rekey/reauth logic in a few ways Date: Fri, 24 Jun 2022 16:07:38 -0700 Message-Id: <20220624230741.1957863-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The rekey/reauth logic was broken in a few different ways. For rekeys the event list was not being reset so any past 4-way handshake would allow the call to pass. This actually removes the need for the sleep in the extended key ID test because the actual handshake event is waited for correctly. For both rekeys and reauths, just waiting for the EAP/handshake events was not enough. Without checking if the client got disconnected we essentially allow a full disconnect and reconnect, meaning the rekey/reauth failed. Now a 'disallow' array can be passed to wait_for_event which will throw an exception if any events in that array are encountered while waiting for the target event. --- autotests/testWPA2-ext-key-id/connection_test.py | 2 -- autotests/util/hostapd.py | 16 ++++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/autotests/testWPA2-ext-key-id/connection_test.py b/autotests/testWPA2-ext-key-id/connection_test.py index d77a216b..afd48149 100644 --- a/autotests/testWPA2-ext-key-id/connection_test.py +++ b/autotests/testWPA2-ext-key-id/connection_test.py @@ -50,8 +50,6 @@ class Test(unittest.TestCase): testutil.test_iface_operstate() testutil.test_ifaces_connected() - wd.wait(0.5) - device.disconnect() condition = 'not obj.connected' diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py index ff5a97c1..758427fe 100644 --- a/autotests/util/hostapd.py +++ b/autotests/util/hostapd.py @@ -102,23 +102,26 @@ class HostapdCLI(object): return True - def _poll_event(self, event): + def _poll_event(self, event, disallow): # Look through the list (most recent is first) until the even is found. # Once found consume this event and any older ones as to not # accidentally trigger a false positive later on. for idx, e in enumerate(self.events): + for d in disallow: + if d in e: + raise Exception('Event %s found while waiting for %s' % (d, event)) if event in e: self.events = self.events[:idx] return e return False - def wait_for_event(self, event, timeout=10): + def wait_for_event(self, event, timeout=10, disallow=[]): if event == 'AP-ENABLED': if self.enabled: return 'AP-ENABLED' - return ctx.non_block_wait(self._poll_event, timeout, event, + return ctx.non_block_wait(self._poll_event, timeout, event, disallow, exception=TimeoutError("waiting for event")) def _data_available(self): @@ -166,8 +169,8 @@ class HostapdCLI(object): self.events = [] cmd = 'EAPOL_REAUTH ' + client_address self.ctrl_sock.sendall(cmd.encode('utf-8')) - self.wait_for_event('CTRL-EVENT-EAP-STARTED') - self.wait_for_event('CTRL-EVENT-EAP-SUCCESS') + self.wait_for_event('CTRL-EVENT-EAP-STARTED', disallow=['AP-STA-DISCONNECTED']) + self.wait_for_event('CTRL-EVENT-EAP-SUCCESS', disallow=['AP-STA-DISCONNECTED']) def reload(self): # Seemingly all three commands needed for the instance to notice @@ -234,7 +237,8 @@ class HostapdCLI(object): if address: cmd = 'REKEY_PTK %s' % address self.ctrl_sock.sendall(cmd.encode('utf-8')) - self.wait_for_event('EAPOL-4WAY-HS-COMPLETED') + self.events = [] + self.wait_for_event('EAPOL-4WAY-HS-COMPLETED', disallow=['AP-STA-DISCONNECTED']) return cmd = 'REKEY_GTK' From patchwork Fri Jun 24 23:07:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895163 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.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 ECE0B4C6F for ; Fri, 24 Jun 2022 23:09:58 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id 184so3660448pga.12 for ; Fri, 24 Jun 2022 16:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gbhjQ2zPW6+dU9vr/yPe+IemjoLojRnPkfy9L4ZkOfY=; b=ayH2rVLV7PGwnAJpAELZ3S2UarKtaYHRT5L6ggpRNBjRZ2JxvqLyH7K9VUQUTt0+eb +M9iXsB3jYdCD8BHVRKvgM9IessAifOmcD2P/sdnlmoNcG8sTk7kFxMkBomNZvE+4KU+ O9aA2UjA4lwKLJD8LAHNdICqFJPOIwHDPQb91PMe9ztjUWkx2qxBWklu88ypHMRRKHN1 A5Zcxyi1uFikvnWN1fYr3tTSpNcYtk7Bc1dpbUiQIMbvfiY9qhPTM8jQGC6lTDUvQk5w ct78Lm690t+T+mTuNACNH0HahyMSgdqAbQA8kAXjYnVRktSTQd9/1uF1XckLsWCqrgd4 UImA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gbhjQ2zPW6+dU9vr/yPe+IemjoLojRnPkfy9L4ZkOfY=; b=EKHSstQJH8hDR7sZtVQqK9SOuEsIB2JCU08IiEMsj49c0LYdjc81avTo43kPDCEimq kpStTAH5KITaVSzvKpQkfG8hGUHJjrxx1fNlacAKlHDMGNISNW0r/JDEamMT8knPF0z2 ZbW2MaXuCBBShfLTn+9Dca0DbP/buj4ncjc+KCMREuqh4/SJFjZ1PWLPQA+3mGNGyqtI dzf4WMaE4MhsfLLK+/f1gg3gdBK9aZ8OePJiR1Myn9HUt6b1plGAcnU42BhzQjJKa0yw 5Be/wr0nwsOhB8CpDmDRgLtHBas0zC9IGN4lz7G7gXBjeh5wqFP92M+QEg+ZyjIDpTQT Qg1A== X-Gm-Message-State: AJIora+9sGNyfSm4EpAG9nRaEaULnU7rc6ktIfs9v/wp0dUiax9z1Sgb BFYRoJQu4whvmHL4ZCc5D5mBTW78bOA= X-Google-Smtp-Source: AGRyM1sx2gAk/eFQ+S5fSWT5ga0JsPprn3TCNGyon1mZVciCapuzngVaoHC62/11mpRokHuE/binTg== X-Received: by 2002:a05:6a00:1821:b0:525:6ed7:cdcc with SMTP id y33-20020a056a00182100b005256ed7cdccmr1378907pfa.70.1656112198139; Fri, 24 Jun 2022 16:09:58 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:57 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 6/8] auto-t: remove sleep in testAgent Date: Fri, 24 Jun 2022 16:07:39 -0700 Message-Id: <20220624230741.1957863-6-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The test here is verifying that a DBus Connect() call will still work with 'other' agents registered. In this case it uses iwctl to set a password, then call Connect() manually. The problem here is that we have no way of knowing when iwctl fully starts and registers its agent. There was a sleep in there but that is unreliable and we occationally were still getting past that without iwctl having started fully. To fix this properly we need to wait for iwctl's agent service to appear on the bus. Since the bus name is unknown we must first find all names, then cross reference their PID's against the iwctl PID. This is done using ListNames, and GetConnectionUnixProcessID APIs. --- autotests/testAgent/agent_test.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/autotests/testAgent/agent_test.py b/autotests/testAgent/agent_test.py index e2d6e49e..c1dc8c7c 100644 --- a/autotests/testAgent/agent_test.py +++ b/autotests/testAgent/agent_test.py @@ -2,6 +2,7 @@ import unittest import sys +import dbus sys.path.append('../util') import iwd @@ -56,11 +57,26 @@ class Test(unittest.TestCase): IWD.clear_storage() def test_connection_with_other_agent(self): + def wait_for_service_pid(pid): + dbus_object = ctx._bus.get_object('org.freedesktop.DBus', + '/org/freedesktop/DBus') + dbus_iface = dbus.Interface(dbus_object, 'org.freedesktop.DBus') + + services = dbus_iface.ListNames() + + for service in services: + bus_iface = dbus.Interface(dbus_object, "org.freedesktop.DBus") + if pid == int(bus_iface.GetConnectionUnixProcessID(service)): + return True + + return False + wd = IWD() iwctl = ctx.start_process(['iwctl', '-P', 'secret_ssid2']) + # Let iwctl to start and register its agent. - wd.wait(2) + ctx.non_block_wait(wait_for_service_pid, 10, iwctl.pid) self.check_connection(wd, 'ssid2') From patchwork Fri Jun 24 23:07:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895164 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.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 CD1583D9D for ; Fri, 24 Jun 2022 23:09:59 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id k127so3739459pfd.10 for ; Fri, 24 Jun 2022 16:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LHQnhPHKIpKt6hHT6rxlnQpXZIaF7nIGw0kXZLa8d9I=; b=QCmvrwuVB+DbCjSE6K62NqDb598LoDruYFv7KAuHRm/BeuFI1fJ3jpmuqijulcvcFG LAnaMk4/h+vk4jxjB9PcZ5QwH+0PGQB43aHlgWeUUs6NOQDegh3UyhEQo/8+IdVRwkKh duZUiqHSQ2oqMRmQylqduMvHbeDGySe1BDYQJ06kXwa7xo1QIdwaiZOglVRpqJ9Ny7Zk E0NQgEPM1yFsO9bIus562GDdZdwyRnUzXJ8PfAvCy2wuDid6O+lunnFCx8dWF7PavMYl LARmPZfrnqAizBTywDeNVdo/uq0N8eIoH04WzowfDCMomKlv7917sNGqmlYCL9XbCNyy lcDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LHQnhPHKIpKt6hHT6rxlnQpXZIaF7nIGw0kXZLa8d9I=; b=r/kzvO/YksipSEOZsXnJdUjxtVFCXsPYglm2kCGXWDu45vMEEFJhmRN9XMBOj6In8r PUO/HpnaAdwaoFAxRmV6G6FTbXBA1IZAKiekhCSX7O+O54EPfDXj9iaV/FsYC0rt9mdN QzDxVvPlNNmev2j2nczaRzgR+ZUQgySr0+/USRyuRtsyoy3IWoMK9z357WSsHSgBGb7m qQtLt4LSswp5Il4ACrGltzqXkAVborZ9HMbBg3xYCZ6vo8jbfyA1pLnA6omTdvG3GFMA L+k15+MZlD3jSCfCGB3xFn4GwEDBbEkDjb9pEb+vo78sWUTgt/omdSBZmK4/FhLPhmx4 Oe0w== X-Gm-Message-State: AJIora+EyFu+uBYwojsFwWoLT87ZObwNmRBhEsspOOIDFpayzYyVib4f S9OY0ZuYzriAIzoh3VXq3WHKwwyH5OY= X-Google-Smtp-Source: AGRyM1vHa2J2bIpatQI21TbU5KNN/AsO51+cfTmEHAZFHvhF2VRK7Gj+QNu4PqOzLP9fRZQrnLKB5w== X-Received: by 2002:a05:6a00:139b:b0:525:3e1b:f630 with SMTP id t27-20020a056a00139b00b005253e1bf630mr1270748pfg.54.1656112199039; Fri, 24 Jun 2022 16:09:59 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:58 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 7/8] eapol: allow 'secure' to be set on rekeys Date: Fri, 24 Jun 2022 16:07:40 -0700 Message-Id: <20220624230741.1957863-7-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 About a month ago hostapd was changed to set the secure bit on eapol frames during rekeys (bc36991791). The spec is ambiguous about this and has conflicting info depending on the sections you read (12.7.2 vs 12.7.6). According to the hostapd commit log TGme is trying to clarify this and wants to set secure=1 in the case of rekeys. Because of this, IWD is completely broken with rekeys since its disallows secure=1 on PTK 1/4 and 2/4. Now, a bool is passed to the verify functions which signifies if the PTK has been negotiated already. If secure differs from this the key frame is not verified. --- src/eapol.c | 14 ++++++++------ src/eapol.h | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/eapol.c b/src/eapol.c index 9f885d02..e8bd5cdb 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -443,7 +443,8 @@ static void eapol_key_data_append(struct eapol_key *ek, if (ek->error) \ return false \ -bool eapol_verify_ptk_1_of_4(const struct eapol_key *ek, size_t mic_len) +bool eapol_verify_ptk_1_of_4(const struct eapol_key *ek, size_t mic_len, + bool ptk_complete) { /* Verify according to 802.11, Section 11.6.6.2 */ VERIFY_PTK_COMMON(ek); @@ -457,7 +458,7 @@ bool eapol_verify_ptk_1_of_4(const struct eapol_key *ek, size_t mic_len) if (ek->key_mic) return false; - if (ek->secure) + if (ek->secure != ptk_complete) return false; if (ek->encrypted_key_data) @@ -475,7 +476,7 @@ bool eapol_verify_ptk_1_of_4(const struct eapol_key *ek, size_t mic_len) return true; } -bool eapol_verify_ptk_2_of_4(const struct eapol_key *ek) +bool eapol_verify_ptk_2_of_4(const struct eapol_key *ek, bool ptk_complete) { uint16_t key_len; @@ -491,7 +492,7 @@ bool eapol_verify_ptk_2_of_4(const struct eapol_key *ek) if (!ek->key_mic) return false; - if (ek->secure) + if (ek->secure != ptk_complete) return false; if (ek->encrypted_key_data) @@ -1151,7 +1152,8 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm, l_debug("ifindex=%u", sm->handshake->ifindex); - if (!eapol_verify_ptk_1_of_4(ek, sm->mic_len)) + if (!eapol_verify_ptk_1_of_4(ek, sm->mic_len, + sm->handshake->ptk_complete)) return; if (sm->handshake->ptk_complete && unencrypted) { @@ -1523,7 +1525,7 @@ static void eapol_handle_ptk_2_of_4(struct eapol_sm *sm, l_debug("ifindex=%u", sm->handshake->ifindex); - if (!eapol_verify_ptk_2_of_4(ek)) + if (!eapol_verify_ptk_2_of_4(ek, sm->handshake->ptk_complete)) return; if (L_BE64_TO_CPU(ek->key_replay_counter) != sm->replay_counter) diff --git a/src/eapol.h b/src/eapol.h index 53ae6e8f..8d8d5252 100644 --- a/src/eapol.h +++ b/src/eapol.h @@ -65,8 +65,9 @@ uint8_t *eapol_decrypt_key_data(enum ie_rsn_akm_suite akm, const uint8_t *kek, const struct eapol_key *frame, size_t *decrypted_size, size_t mic_len); -bool eapol_verify_ptk_1_of_4(const struct eapol_key *ek, size_t mic_len); -bool eapol_verify_ptk_2_of_4(const struct eapol_key *ek); +bool eapol_verify_ptk_1_of_4(const struct eapol_key *ek, size_t mic_len, + bool ptk_complete); +bool eapol_verify_ptk_2_of_4(const struct eapol_key *ek, bool ptk_complete); bool eapol_verify_ptk_3_of_4(const struct eapol_key *ek, bool is_wpa, size_t mic_len); bool eapol_verify_ptk_4_of_4(const struct eapol_key *ek, bool is_wpa); From patchwork Fri Jun 24 23:07:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 12895165 Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.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 BCBC34A02 for ; Fri, 24 Jun 2022 23:10:00 +0000 (UTC) Received: by mail-pg1-f169.google.com with SMTP id 184so3660512pga.12 for ; Fri, 24 Jun 2022 16:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OCkwC2D0RD4oXZXaVih5oSm/+99d3lakST5G0fiiLKM=; b=EmT9NJSOAp3rzRQVOaqUsa0ay+4nmuozTAirCbdl0XjYMtSRo+0gCXuAdAIA7yPi6h VONpaaXk0DEZjKifZSYrKrtbwlgEGNBySCg0Ae+tq5CkM8FF213QtUtpNtCjSxnkwOlB hHWq0KL9qGVxmoz4ba2q7JMijmCwjjfIBSCZ7U+px2hsqUM0/Ezi40EdvSArWYtlrdTG lHxTuvx0AXb+Psp5OnELugkuq3HXxGxrJgj8gDyQ6XKJfMBXgQ72JPNxiKkfU+tgSV8j ZxfKm3sukxGIyBDVjNho53CQDw7ycCc1pyPorYQ20Q1dPj/a7QZPfKUuoogt6lqb0Xk5 wBkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OCkwC2D0RD4oXZXaVih5oSm/+99d3lakST5G0fiiLKM=; b=B0QjbAAxTLYClbqZ6oAHXXz6eLCBfxSD9xK58YK41KRzX4Z9e9kFztwaJqPwdvqJkE dDzUjMEVPeX0tz7rlFQ3VKORorrmUMdoTYn1ZclpSmcQkO6Y5X/qpxCXxFGTs7RzTs78 9o8jCYFsvWa4nbubydOnuBSctED+qqspd1sBPz5rgr8uv5E2id0gVkEIXMSIuQhv516o 9VTJEFiI/OHnZNTTCul7/mnk+iTCkNw0X/7rNfzUSp2uv6uH13tnQ2VRvQCPP7P4EKlv UW2Q2gslNx1TC4e+iw9rXRj0ElAG+ARXEg78gJxTIMBBDwleNJF/mpz5LQ3mPRjwoSXR BaWQ== X-Gm-Message-State: AJIora+GYT+ffF57dqzp1mvOIGOuY5tRtQDq3yzDKGTew/5ycCdkF1Rm 6PQK0LmMbq99+KEiWFu01j1Twj0rzzM= X-Google-Smtp-Source: AGRyM1vPOIEuxkvYpxbp+UAwbSwu2Y5K3j/JizgXz7i1d/DW1D/4o9P6Jrs/XPgQKSEDqyqCAKU1vw== X-Received: by 2002:a63:d50f:0:b0:408:994a:96d5 with SMTP id c15-20020a63d50f000000b00408994a96d5mr1074841pgg.299.1656112200018; Fri, 24 Jun 2022 16:10:00 -0700 (PDT) Received: from localhost.localdomain ([50.45.187.22]) by smtp.gmail.com with ESMTPSA id 64-20020a17090a09c600b001ec9ae91e30sm4449767pjo.12.2022.06.24.16.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 16:09:59 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 8/8] unit: update test-eapol to use the new ptk verify APIs Date: Fri, 24 Jun 2022 16:07:41 -0700 Message-Id: <20220624230741.1957863-8-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220624230741.1957863-1-prestwoj@gmail.com> References: <20220624230741.1957863-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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unit/test-eapol.c b/unit/test-eapol.c index d3cfac11..227e485f 100644 --- a/unit/test-eapol.c +++ b/unit/test-eapol.c @@ -1768,13 +1768,13 @@ static void eapol_4way_test(const void *data) step1 = eapol_key_validate(eapol_key_data_3, sizeof(eapol_key_data_3), 16); assert(step1); - assert(eapol_verify_ptk_1_of_4(step1, 16)); + assert(eapol_verify_ptk_1_of_4(step1, 16, false)); memcpy(anonce, step1->key_nonce, sizeof(step1->key_nonce)); step2 = eapol_key_validate(eapol_key_data_4, sizeof(eapol_key_data_4), 16); assert(step2); - assert(eapol_verify_ptk_2_of_4(step2)); + assert(eapol_verify_ptk_2_of_4(step2, false)); memcpy(snonce, step2->key_nonce, sizeof(step2->key_nonce)); assert(!crypto_psk_from_passphrase(passphrase, (uint8_t *) ssid, @@ -1853,13 +1853,13 @@ static void eapol_wpa2_handshake_test(const void *data) ptk_step1 = eapol_key_validate(eapol_key_data_7, sizeof(eapol_key_data_7), 16); assert(ptk_step1); - assert(eapol_verify_ptk_1_of_4(ptk_step1, 16)); + assert(eapol_verify_ptk_1_of_4(ptk_step1, 16, false)); memcpy(anonce, ptk_step1->key_nonce, sizeof(ptk_step1->key_nonce)); ptk_step2 = eapol_key_validate(eapol_key_data_8, sizeof(eapol_key_data_8), 16); assert(ptk_step2); - assert(eapol_verify_ptk_2_of_4(ptk_step2)); + assert(eapol_verify_ptk_2_of_4(ptk_step2, false)); memcpy(snonce, ptk_step2->key_nonce, sizeof(ptk_step2->key_nonce)); assert(!crypto_psk_from_passphrase(passphrase, (uint8_t *) ssid, @@ -1983,13 +1983,13 @@ static void eapol_wpa_handshake_test(const void *data) ptk_step1 = eapol_key_validate(eapol_key_data_13, sizeof(eapol_key_data_13), 16); assert(ptk_step1); - assert(eapol_verify_ptk_1_of_4(ptk_step1, 16)); + assert(eapol_verify_ptk_1_of_4(ptk_step1, 16, false)); memcpy(anonce, ptk_step1->key_nonce, sizeof(ptk_step1->key_nonce)); ptk_step2 = eapol_key_validate(eapol_key_data_14, sizeof(eapol_key_data_14), 16); assert(ptk_step2); - assert(eapol_verify_ptk_2_of_4(ptk_step2)); + assert(eapol_verify_ptk_2_of_4(ptk_step2, false)); memcpy(snonce, ptk_step2->key_nonce, sizeof(ptk_step2->key_nonce)); assert(!crypto_psk_from_passphrase(passphrase, (uint8_t *) ssid,