From patchwork Sat Mar 9 19:42:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=SWszMg+Q; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Stt50ABw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD27rrz23r8 for ; Sun, 10 Mar 2024 06:43:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kz2Od07vcyrRm60aMgNKR/4pRnficTTGyplOjFOH7h8=; b=SWszMg+QuyKGz6 ck647sVcsHez19EEDJ/1jUwNbPgMQ8GJlb2oRqjxuO5MPTBYE41bt5a8KTAnrF0YFKtLo3gUGJj55 GUTKkTCEc3aBTWSXo0MG59Ugnree6klU3QT6CXozQID5tAOidSbz/NfQgU4gWFGkL6exX0K7/BiVb X5QQgysjR9AwBDS365gtGQ+dGHPuo6yKP5scSy8bq+o6O4m9xl+KTQDg3I8lE4qddXD2udYHtQt3S nKqYKbJfLv2EAPfNi4D4TYMus0dDxG/tNYrbo3Hu71bKv5rhBv3ggXVVr8U8kzzsbpPURGmgiy7ID Z/IgJFqwDjS12nNzdCSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2as-0000000E6tC-1xlQ; Sat, 09 Mar 2024 19:42:54 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2an-0000000E6qD-2aTc for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:51 +0000 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5683247fd0fso2180532a12.3 for ; Sat, 09 Mar 2024 11:42:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013365; x=1710618165; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dyghfQ7FImTujzgxzDssJv+iL0Ub3RSjG92tO0di56g=; b=Stt50ABwo7zwwBFX7RxISxV5zkhUkzumz2zyMZew0WNdWHaDYHvaQLIyrZ13aG80Z7 WRfhDCHLgvUkIzvV5YwySV42D87DG5GWnREuMauKr/dRf5xn/6rVmcSxHb3kIJOjcgaJ ZV48TghuPvVsNxBnlnHQTK7lwkjCgKtsl8vn5kX+vkS1MJX7rLAMJB6iBB5SNly1y1HQ 2VBddnfpN0AtZ/qJYPd/oDxCuYu8KhjQLUPvq27QMPcjP2KwCbPieyE1PF1XhCjWamK+ mlrsi/lMwVhfHzPJDJCBgxzGdToycdVONOuvl2Yhu2lXoHbdfikhRoLVUOgQGZ9e2tL/ sgIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013365; x=1710618165; 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=dyghfQ7FImTujzgxzDssJv+iL0Ub3RSjG92tO0di56g=; b=QBBJCgAwBMC6PaRAYizSt1OPOlMgbMeRGFJYYFZDwvFNDvqfZXeey03tERzAsRJc5L AesTTXuTLcfIdJBHhPZApoqygdVvNoBO9jdlnmVmFVSxm7amJ+Prqtq7DGgrcxUgQlc8 4bOwox/g49KRKjjUUfTqbwSCu+JemHxwuwncGs1rd0cvvg7e6CEhtivb6li0BW063W5S T6QUTuXp0lxNYl+m9dg2FisQnUuGU83mb8nuTQDwH9t1eFvpl+xrPrlkEy3NHHU5nDdI nI0Gimy9bhw2oV7gSTNi40W3wcU1XxCTVYHo1iStKb8vGOeT1zTu6XZK0+alkdu0q7e+ YdgQ== X-Gm-Message-State: AOJu0Yy14KkGalkKUJGpmOCmrmglvch8TCTbuZ2O3QPLuXtKys0lMP+H adMUUioDkMw2bg9nndhR0EmCRQsK0dxjL1nUFvK6VHFFk6UItR66H9bqzdUK X-Google-Smtp-Source: AGHT+IFRy7TY5IBNhI+00CkhhevzRSEBuVtxN+/awDEsJ3KvPVrGu/O5as72rvhctQOHYN8JQOlKrw== X-Received: by 2002:a50:9e81:0:b0:565:e060:5567 with SMTP id a1-20020a509e81000000b00565e0605567mr1760242edf.31.1710013364476; Sat, 09 Mar 2024 11:42:44 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:44 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 1/7] tests: remotehost: extend proc api Date: Sat, 9 Mar 2024 20:42:22 +0100 Message-Id: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114249_698645_B35132C7 X-CRM114-Status: UNSURE ( 9.72 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Janusz Dziedzic --- tests/hwsim/remotehost.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index 9d7c657a1..d0efa210b 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -161,8 +161,8 @@ class Host(): i [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52f listed in] [list.dnswl.org] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Janusz Dziedzic --- tests/hwsim/remotehost.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index 9d7c657a1..d0efa210b 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -161,8 +161,8 @@ class Host(): if t.is_alive(): t.join(wait) - def pending(self, s, timeout=0): - [r, w, e] = select.select([s], [], [], timeout) + def proc_pending(self, proc, timeout=0): + [r, w, e] = select.select([proc.stdout], [], [], timeout) if r: return True return False @@ -194,7 +194,7 @@ class Host(): start = os.times()[4] try: while True: - while self.pending(proc.stdout): + while self.proc_pending(proc): line = proc.stdout.readline() if not line: return None @@ -207,13 +207,26 @@ class Host(): remaining = start + timeout - now if remaining <= 0: break - if not self.pending(proc.stdout, timeout=remaining): + if not self.proc_pending(proc, timeout=remaining): break except: logger.debug(traceback.format_exc()) pass return None + def proc_write(self, proc, cmd): + return proc.stdout.write(cmd) + + def proc_read(self, proc, timeout=0): + if not self.proc_pending(proc): + return None + res = proc.stdout.read(4094).decode() + try: + r = str(res) + except UnicodeDecodeError as e: + r = res + return r + def proc_stop(self, proc): if not proc: return From patchwork Sat Mar 9 19:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=vurO9Dvk; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=kiS13BdS; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD0qpsz23r4 for ; Sun, 10 Mar 2024 06:43:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KNyfsYy3JQS3QvMPTQaUM9U/xNGJSG05gomdUsFZxqQ=; b=vurO9DvkEYNEvC fHRsnHqsPXesDAyXt1X/kpACkDLnfgwDpN4xn/h8OS8N2AfY1dOphwfMkRF7dizcT4sEZ8L5sTBQk /UClgl9oC6fzx+w5dEbOyyTPfjenn25suDnRrbOT0H6LoRjOnA0jiAVzFGa8ySJJsnBshCGGAyHU1 Joyinbov8nwZUclyevwE/t1HyVcDLr+im3F8E3Wm0VgcIld4y7IF6GiiT3WH6dOH4g6FM5X+w21z0 FxDDAK0fG71+KqIi35HycqqQmVlPtHwHy2JbHhN6M3pX8lrz2XoG1KC52B+bRWy5grwZr4Hnx4pZa bBr868Djssa7MEK4EkZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2ar-0000000E6sZ-0VIp; Sat, 09 Mar 2024 19:42:53 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2an-0000000E6qG-2B4I for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:51 +0000 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-56759dc7ea6so3981838a12.1 for ; Sat, 09 Mar 2024 11:42:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013365; x=1710618165; darn=lists.infradead.org; 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=LYddR2YWaY1BNKekq71z9vaBjKE9EvgYx2PUMY5S6j4=; b=kiS13BdSB45V4eTd3wnkHYPOvbVktXKi0eYQovfnRRiqSpkwBOiHYYC0ahMAU4WtJy vCSzengqkU2fB+sKngvH0L/jVBL6mmbyoaeIOZY8T895SYgcHHNIY1HGAbFZ65CgynuT qt3sPTa+gXYCALaCc6+UvWuRJvNwQtPZb1gaXse+SrwdqLcuVWJe7YPBqsJ3x820X549 /8mpTkSevX5xiDDZ+NVFgwBzoZlPA+IMfEtGlVtMaqcJ4GQbYvWHfYj10rsDBAviUBoH OI44W97QgMQOq/Yw1NFVYgab/ubblRoEURA4GyOPJLIWFNtrHxnRDcygO8du7RDAbR8g lo6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013365; x=1710618165; 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=LYddR2YWaY1BNKekq71z9vaBjKE9EvgYx2PUMY5S6j4=; b=mUHfCc62TxI0Nt1+ZUlRbZKbvCIHCOFR9a33O86y/OWJ0xDsWucVkBYDUzgq2naAKt 3Mio234E33EwTTlANbrOjCLegxje4fXHPwU39888JiHaMSuukiZoJK9bxnhAwxy/um6w PkfUvhuty0DxM997b471K3zcqKZp3uLMhaQR+hJzRKLEHR+i2U1OJIlQKgFWpPsqNeb2 QWrKTQnbckvGwkgd2IKSVN99qa0QA7o6bnVfN/b5yyZbqB2Qo26kwODVoGw+CLtv8eBf iGeEkwVHzvmsF9uMDKicc3IzS4V10GXC5I4nQmnGVl/x7CgJUKO0uRfD9OwZ55MIDgGT qj8Q== X-Gm-Message-State: AOJu0YwLHI+pzgM+4e3lxf6+lJ5pv7SKqpPh6G58P10TT9zYMBiag/RN 9y94ve9jlh3JgqkQtbFQFaVxvRqVzQtEmcwqJgFiB8t0xofB020WIbYovi05 X-Google-Smtp-Source: AGHT+IHjFkIJYxyOM6GAM8JU6gI0uhNQz2NPAF80NIVYlHxdG6ywDAqys7/v5hxJ49p0j7e7wtszJg== X-Received: by 2002:a50:9305:0:b0:566:d25e:b73c with SMTP id m5-20020a509305000000b00566d25eb73cmr1944726eda.35.1710013365128; Sat, 09 Mar 2024 11:42:45 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:44 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 2/7] wpaspy: add option to use wpa_cli Date: Sat, 9 Mar 2024 20:42:23 +0100 Message-Id: <20240309194228.4186699-2-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> References: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114249_592605_B85720B2 X-CRM114-Status: GOOD ( 12.61 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This one allow connection to remote/local host via SSH and use wpa_cli. Signed-off-by: Janusz Dziedzic --- wpaspy/wpaspy.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This one allow connection to remote/local host via SSH and use wpa_cli. Signed-off-by: Janusz Dziedzic --- wpaspy/wpaspy.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 5b8140b7c..ae305c8d5 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -10,16 +10,26 @@ import os import stat import socket import select +import remotehost counter = 0 class Ctrl: - def __init__(self, path, port=9877): + def __init__(self, path, port=9877, hostname=None, ifname=None): global counter self.started = False self.attached = False self.path = path self.port = port + self.ifname = ifname + self.host = None + self.proc = None + self.hostname = hostname + + if hostname: + self.host = remotehost.Host(hostname) + self.started = True + return self.udp = False if not path.startswith('/'): @@ -74,6 +84,11 @@ class Ctrl: # Need to ignore this allow the socket to be closed self.attached = False pass + + if self.host and self.started: + self.started = False + return + if self.started: self.s.close() if not self.udp: @@ -81,6 +96,15 @@ class Ctrl: self.started = False def request(self, cmd, timeout=10): + if self.host: + cmd = '\'' + cmd + '\'' + if self.ifname: + _cmd = ['wpa_cli', '-p', self.path, '-i', self.ifname, "raw " + cmd] + else: + _cmd = ['wpa_cli', '-g', self.path, "raw " + cmd] + status, buf = self.host.execute(_cmd) + return buf + if type(cmd) == str: try: cmd2 = cmd.encode() @@ -104,6 +128,16 @@ class Ctrl: def attach(self): if self.attached: return None + + if self.host: + if self.ifname: + _cmd = [ "wpa_cli", "-p", self.path, "-i", self.ifname ] + else: + _cmd = [ "wpa_cli", '-g', self.path] + self.proc = self.host.proc_run(_cmd) + self.attached = True + return + res = self.request("ATTACH") if "OK" in res: self.attached = True @@ -113,6 +147,15 @@ class Ctrl: def detach(self): if not self.attached: return None + + if self.hostname and self.proc: + self.request("DETACH") + self.request("QUIT") + self.host.proc_stop(self.proc) + self.attached = False + self.proc = None + return None + if self.s.fileno() == -1: self.attached = False return None @@ -135,12 +178,19 @@ class Ctrl: self.close() def pending(self, timeout=0): + if self.host and self.proc: + return self.host.proc_pending(self.proc, timeout=timeout) + [r, w, e] = select.select([self.s], [], [], timeout) if r: return True return False def recv(self): + if self.host and self.proc: + res = self.host.proc_read(self.proc) + return res + res = self.s.recv(4096).decode() try: r = str(res) From patchwork Sat Mar 9 19:42:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910130 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Lm6tgolO; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=APx6RjHw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD0bTrz23qr for ; Sun, 10 Mar 2024 06:43:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NBoigVwaYVl9+PI86x2ymJoZgCrzTGSDnzezqsnevhA=; b=Lm6tgolO4s2zO1 8f1+nbm5Ico+e1ZKo3tR7bJZeA7UIA3INhXmWVLDDrraAG/zNobtgrTbDxIAupqvo70ruAoi7g0ln OXx6yXXrLPU3r9MOWRAxHebzv7R7X6kgNOhsjITVcCx8I68gqInZzwrR+BEE9XfmVcSzZ4hlMY3g2 REmtjKJiVhesBUpO+XpYVjG7R3gFb7xrx3dOH2HYZlIbiS9+kmMlAhmIqK2CzhrIjVwX6fp+zbl5+ a0+8mn9HrfPSifUNYwb2r4hb651hI82oGlS0JcgyejXAA53L8tyoLFIBEkMfamfTEjqEY7LDu5aRt 4g7nxNDJ8EYRms1CiFMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2ay-0000000E6uL-0Nvf; Sat, 09 Mar 2024 19:43:00 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2an-0000000E6qH-3gje for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:52 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-56838e00367so1133871a12.0 for ; Sat, 09 Mar 2024 11:42:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013366; x=1710618166; darn=lists.infradead.org; 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=B77Rjz/SCRHx9orcp94Ox2FRCKtQczQmbqLSe0S7QB4=; b=APx6RjHw2uCHu6nM5wVpz9JHBXAviX47pY658foX8cDtt1z9nlUDj8IfKHrmuZZPI5 hYtFq00ZFNWxbqfd+xaFr1JXMUmqbnV5Et0mxoJli90a2Jal3QDHCruES/qiTQXdp/EI ehKdZbMLBKH5ibyLyaHh0bJFsIBdqD2m+vJPVvu8V/pb+qFKQd8pZDrc4o4VQSynpNBb wG5Et3FhcgyuEePwuHlNAfTVmOwUxEMPNlVCSC6QoJTUn9rVoY3rI3q++TYauoSNPl9t MBzo5YSlszBWgaV5U1kTir5uIBaY+rDOXRVUDVwQWWIgdBrLUakhHjjkLc04RF4mEh6E niSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013366; x=1710618166; 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=B77Rjz/SCRHx9orcp94Ox2FRCKtQczQmbqLSe0S7QB4=; b=KSsY/UiWWev+kcYysEMx4Myj0zik4KBd0hune9Apm8HRPO93P4JI5zUUSE8Vaa7jRh iYcf0opo2nStiQcpz7m+gxKPq+bVhoeLYs/7a40FAj+4EEHao16NThHzZCdwwrvxF2qr MqvJdw+CiX7Mq8zdzTJVuwKNGPpG47oqx3t9D4RUwOw73qTRpnbAOXos1PZFajPB1CZV 4WRMlmLEAu6kniqv5nOGO2WyPcC0h80GRv04abITXVL678kgAUygklxygjVErPmeHXzW MTVPCIsiTNrsrIgIPIqfDvY1lfz6xR436BrIz7IBGPtbN1VcLrzIe0LeNWpS91o0vGxb WPQg== X-Gm-Message-State: AOJu0YybnzW4lJnpZgus06KBeNkaHullVtrDw49COEjOpYNdtdRnC/y2 1OUmT/zMCdZz4yI+CkjMpqIZVBVXu5D9ShldWVtFPBej/5ycqETrCnYJmcao X-Google-Smtp-Source: AGHT+IEh1QqGnr/KbhivyPHozUdciwG97go1calax7WXFFquq6B/BctsiSd9YViHjVt0IYY0xmcsNA== X-Received: by 2002:a50:9e85:0:b0:566:9fef:1ee9 with SMTP id a5-20020a509e85000000b005669fef1ee9mr1856423edf.22.1710013365748; Sat, 09 Mar 2024 11:42:45 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:45 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 3/7] tests: wpasupplicant: allow to use remote wpa_cli Date: Sat, 9 Mar 2024 20:42:24 +0100 Message-Id: <20240309194228.4186699-3-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> References: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114250_083907_FBD8398A X-CRM114-Status: GOOD ( 10.66 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Janusz Dziedzic --- tests/hwsim/wpasupplicant.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 8912310b9..15dce0ac9 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -19,7 +19,7 @@ wpas_ [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:531 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Janusz Dziedzic --- tests/hwsim/wpasupplicant.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index 8912310b9..15dce0ac9 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -19,7 +19,7 @@ wpas_ctrl = '/var/run/wpa_supplicant' class WpaSupplicant: def __init__(self, ifname=None, global_iface=None, hostname=None, - port=9877, global_port=9878, monitor=True): + port=9877, global_port=9878, monitor=True, remote_cli=False): self.monitor = monitor self.hostname = hostname self.group_ifname = None @@ -31,6 +31,7 @@ class WpaSupplicant: self.ifname = None self.host = remotehost.Host(hostname, ifname) self._group_dbg = None + self.remote_cli = remote_cli if ifname: self.set_ifname(ifname, hostname, port) res = self.get_driver_status() @@ -42,10 +43,16 @@ class WpaSupplicant: self.global_iface = global_iface if global_iface: if hostname != None: - self.global_ctrl = wpaspy.Ctrl(hostname, global_port) - if self.monitor: - self.global_mon = wpaspy.Ctrl(hostname, global_port) - self.global_dbg = hostname + "/" + str(global_port) + "/" + if remote_cli: + self.global_ctrl = wpaspy.Ctrl(global_iface, global_port, hostname=hostname) + if self.monitor: + self.global_mon = wpaspy.Ctrl(global_iface, global_port, hostname=hostname) + self.global_dbg = hostname + "/global" + else: + self.global_ctrl = wpaspy.Ctrl(hostname, global_port) + if self.monitor: + self.global_mon = wpaspy.Ctrl(hostname, global_port) + self.global_dbg = hostname + "/" + str(global_port) + "/" else: self.global_ctrl = wpaspy.Ctrl(global_iface) if self.monitor: @@ -164,9 +171,14 @@ class WpaSupplicant: self.remove_ifname() self.ifname = ifname if hostname != None: - self.ctrl = wpaspy.Ctrl(hostname, port) - if self.monitor: - self.mon = wpaspy.Ctrl(hostname, port) + if self.remote_cli: + self.ctrl = wpaspy.Ctrl(wpas_ctrl, port, hostname=hostname, ifname=ifname) + if self.monitor: + self.mon = wpaspy.Ctrl(wpas_ctrl, port, hostname=hostname, ifname=ifname) + else: + self.ctrl = wpaspy.Ctrl(hostname, port) + if self.monitor: + self.mon = wpaspy.Ctrl(hostname, port) self.host = remotehost.Host(hostname, ifname) self.dbg = hostname + "/" + ifname else: @@ -185,6 +197,8 @@ class WpaSupplicant: def get_ctrl_iface_port(self, ifname): if self.hostname is None: return None + if self.remote_cli: + return None res = self.global_request("INTERFACES ctrl") lines = res.splitlines() From patchwork Sat Mar 9 19:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YTjHZy6G; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=VyNO3eTl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD0Xcfz23qg for ; Sun, 10 Mar 2024 06:43:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MKJIP+jwHzo5WiAEDFTgnZRLGXY/cgiZzrTURcnfXN4=; b=YTjHZy6G1Hp6zC Jn3LohBy3ulFckr6at/R8SK/xZMrthzcHAE7Mz5X8yF28WaVNBzg3DPMdA9PM27Aq3T7sxsWoHHty Nw+DY6gd/CQaxMhU53BNL+KU8YD0T6Bik5tHNQn6qptBE668hgB4yaUjj3Jf4sqefcXDw6XXRkztf OPxyO6ib27yDKPS4r6hXwa39AplpV7rNyQlsuD+7YOJ10SuAIGsoskyUeArLK2UhQcyPCKW7ksGYz FOs2quKOR0pFVBQVOaLolSmgKeFgTMFoz9v+Gs/0l8VSqHXW9rG0Wns5Z3B1XMfUfEY48zrgKj+id reHgEudW7LwDBV0fQqLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2av-0000000E6tp-1y9N; Sat, 09 Mar 2024 19:42:57 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2ao-0000000E6qJ-2moc for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:53 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2d41d1bedc9so23716311fa.3 for ; Sat, 09 Mar 2024 11:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013366; x=1710618166; darn=lists.infradead.org; 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=v/Dy/uQc5YtmJNCfr2DU4xEDnu9gfua0KbQKokTGI/w=; b=VyNO3eTlb8DOA8umrkiNbRCgkP1s4hZFmBewLlKkftrwISY3GDCT04FTL+1wZcbjMv wAN7+VZRQHc7Hag4w/iAMadV0fhdM3joql+dT6uyNrdANzBkhVU+/dQhPpUOZmuIbJ37 1eZbC+bgip9Q8w5m1dm9+K8IAUBLTHCNHY2WZPEtUp44710fppgmUiDPgGhuQ+Wk5s65 OoKR0DReN2Tns+VFw32Gu4Wa0/rTJOJrAuwySpSS0Fv8Ub5u45Gk7WgpvyA4XPWfTEeK CwgnTXe4SNql8Nf1PcCA7HiO5nSoLMLl3EK16eMkGqqw5CTmKorAoGe4BAsfpJzTmMdb R71w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013366; x=1710618166; 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=v/Dy/uQc5YtmJNCfr2DU4xEDnu9gfua0KbQKokTGI/w=; b=a6z8Ol4o9Wq9Fi3V9RVS465xFLADtA2zrngtsdgSQu57vraoTjvDCt1HHsr7U/k99m UCfbBp+wG1g83T+Ox91/i0/rqfGCE0GTX6azB2Gm3P1o1AGkY8W87LBVc9/TJbxV+gBs R5n86lfMwlfDQnwrxKhw1sYxAO5IJdkz43ArhjJbbXMf1C8Ywi8ZJURbDFwgYBbi/l8o n/lXKFv51hK7fY78XI8HP4E6fd9Sj5aTWx2KxcrGbVhMGg17Kl870Q7pfPgHxz/BnA3Y t6mdw2bVYL9SaUHLwfYkd0dTA0G3YtQnLGcuBGwvVksMq4gEMF3gqzjaIM0gtq/CmSXD ESmg== X-Gm-Message-State: AOJu0Yy3HvVw+ihEcAc8EAQMRWcXl15MwCTdN+wEV6ptyVtOJHQK2Hk7 joQjJRka+GISeL36lTHSqy6MXvvK5qUWCkMFWxu6DcwfYmLbcdc5rFa/UIpC X-Google-Smtp-Source: AGHT+IFYlVzqaRPAiL4FF2VvoXTrIZP8iKZzBj17tc9iwlOwt3WPh5M9a/cwqsYbxoDNsm1+GVIhSQ== X-Received: by 2002:a2e:9484:0:b0:2d2:d35f:4ec4 with SMTP id c4-20020a2e9484000000b002d2d35f4ec4mr1495995ljh.14.1710013366353; Sat, 09 Mar 2024 11:42:46 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:46 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 4/7] tests: hostapd: allow to use remote wpa_cli Date: Sat, 9 Mar 2024 20:42:25 +0100 Message-Id: <20240309194228.4186699-4-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> References: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114250_728307_A0F22099 X-CRM114-Status: GOOD ( 10.54 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Janusz Dziedzic --- tests/hwsim/hostapd.py | 64 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 754faf623..3e104a366 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -28,12 +28,18 @@ class HostapdGlobal: try: h [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:229 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Janusz Dziedzic --- tests/hwsim/hostapd.py | 64 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 754faf623..3e104a366 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -28,12 +28,18 @@ class HostapdGlobal: try: hostname = apdev['hostname'] port = apdev['port'] + if 'remote_cli' in apdev: + remote_cli = apdev['remote_cli'] + else: + remote_cli = False except: hostname = None port = 8878 + remote_cli = False self.host = remotehost.Host(hostname) self.hostname = hostname self.port = port + self.remote_cli = remote_cli if hostname is None: global_ctrl = hapd_global if global_ctrl_override: @@ -42,9 +48,17 @@ class HostapdGlobal: self.mon = wpaspy.Ctrl(global_ctrl) self.dbg = "" else: - self.ctrl = wpaspy.Ctrl(hostname, port) - self.mon = wpaspy.Ctrl(hostname, port) - self.dbg = hostname + "/" + str(port) + if remote_cli: + global_ctrl = hapd_global + if global_ctrl_override: + global_ctrl = global_ctrl_override + self.ctrl = wpaspy.Ctrl(global_ctrl, port, hostname=hostname) + self.mon = wpaspy.Ctrl(global_ctrl, port, hostname=hostname) + self.dbg = hostname + "/global" + else: + self.ctrl = wpaspy.Ctrl(hostname, port) + self.mon = wpaspy.Ctrl(hostname, port) + self.dbg = hostname + "/" + str(port) self.mon.attach() def cmd_execute(self, cmd_array, shell=False): @@ -119,6 +133,9 @@ class HostapdGlobal: if self.hostname is None: return None + if self.remote_cli: + return None + res = self.request("INTERFACES ctrl") lines = res.splitlines() found = False @@ -147,17 +164,22 @@ class HostapdGlobal: class Hostapd: def __init__(self, ifname, bssidx=0, hostname=None, ctrl=hapd_ctrl, - port=8877): + port=8877, remote_cli=False): self.hostname = hostname self.host = remotehost.Host(hostname, ifname) self.ifname = ifname + self.remote_cli = remote_cli if hostname is None: self.ctrl = wpaspy.Ctrl(os.path.join(ctrl, ifname)) self.mon = wpaspy.Ctrl(os.path.join(ctrl, ifname)) self.dbg = ifname else: - self.ctrl = wpaspy.Ctrl(hostname, port) - self.mon = wpaspy.Ctrl(hostname, port) + if remote_cli: + self.ctrl = wpaspy.Ctrl(ctrl, port, hostname=hostname, ifname=ifname) + self.mon = wpaspy.Ctrl(ctrl, port, hostname=hostname, ifname=ifname) + else: + self.ctrl = wpaspy.Ctrl(hostname, port) + self.mon = wpaspy.Ctrl(hostname, port) self.dbg = hostname + "/" + ifname self.mon.attach() self.bssid = None @@ -638,22 +660,30 @@ def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30, try: hostname = apdev['hostname'] port = apdev['port'] - logger.info("Starting AP " + hostname + "/" + port + " " + ifname) + if 'remote_cli' in apdev: + remote_cli = apdev['remote_cli'] + else: + remote_cli = False + if 'global_ctrl_override' in apdev: + global_ctrl_override = apdev['global_ctrl_override'] + logger.info("Starting AP " + hostname + "/" + port + " " + ifname + " remote_cli " + str(remote_cli)) except: logger.info("Starting AP " + ifname) hostname = None port = 8878 + remote_cli = False else: ifname = apdev logger.info("Starting AP " + ifname + " (old add_ap argument type)") hostname = None port = 8878 + remote_cli = False hapd_global = HostapdGlobal(apdev, global_ctrl_override=global_ctrl_override) hapd_global.remove(ifname) hapd_global.add(ifname, driver=driver) port = hapd_global.get_ctrl_iface_port(ifname) - hapd = Hostapd(ifname, hostname=hostname, port=port) + hapd = Hostapd(ifname, hostname=hostname, port=port, remote_cli=remote_cli) if not hapd.ping(): raise Exception("Could not ping hostapd") hapd.set_defaults(set_channel=set_channel) @@ -688,17 +718,22 @@ def add_bss(apdev, ifname, confname, ignore_error=False): try: hostname = apdev['hostname'] port = apdev['port'] - logger.info("Starting BSS " + hostname + "/" + port + " phy=" + phy + " ifname=" + ifname) + if 'remote_cli' in apdev: + remote_cli = apdev['remote_cli'] + else: + remote_cli = False + logger.info("Starting BSS " + hostname + "/" + port + " phy=" + phy + " ifname=" + ifname + " remote_cli=" + str(remote_cli)) except: logger.info("Starting BSS phy=" + phy + " ifname=" + ifname) hostname = None port = 8878 + remote_cli = False hapd_global = HostapdGlobal(apdev) confname = cfg_file(apdev, confname, ifname) hapd_global.send_file(confname, confname) hapd_global.add_bss(phy, confname, ignore_error) port = hapd_global.get_ctrl_iface_port(ifname) - hapd = Hostapd(ifname, hostname=hostname, port=port) + hapd = Hostapd(ifname, hostname=hostname, port=port, remote_cli=remote_cli) if not hapd.ping(): raise Exception("Could not ping hostapd") return hapd @@ -708,17 +743,22 @@ def add_iface(apdev, confname): try: hostname = apdev['hostname'] port = apdev['port'] - logger.info("Starting interface " + hostname + "/" + port + " " + ifname) + if 'remote_cli' in apdev: + remote_cli = apdev['remote_cli'] + else: + remote_cli = False + logger.info("Starting interface " + hostname + "/" + port + " " + ifname + "remote_cli=" + str(remote_cli)) except: logger.info("Starting interface " + ifname) hostname = None port = 8878 + remote_cli = False hapd_global = HostapdGlobal(apdev) confname = cfg_file(apdev, confname, ifname) hapd_global.send_file(confname, confname) hapd_global.add_iface(ifname, confname) port = hapd_global.get_ctrl_iface_port(ifname) - hapd = Hostapd(ifname, hostname=hostname, port=port) + hapd = Hostapd(ifname, hostname=hostname, port=port, remote_cli=remote_cli) if not hapd.ping(): raise Exception("Could not ping hostapd") return hapd From patchwork Sat Mar 9 19:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RsWruIjr; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=FHo43NQW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD15sdz23r5 for ; Sun, 10 Mar 2024 06:43:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DS7Ns2PHtjwVusrw0n8RmcyDZck/JhlzVYBrxKXKrC0=; b=RsWruIjrZTrvow DbOZwNHQpIj/EQjXKvY+HcCfzxr2ndM7Hl/j8MGwe7yo9WoW7g1oihi94rPt9bzDQNIT99/KlblwL rDPagtJ0bMmZiSYn113l74/9jnldJK97qcRqLS2i1jd9v6m0j+/EhA2PHlGfvVzOBYGb+CZuk5Q79 uQEZF2vF/BLAAluFBNcTKYaJgQtqfOtLDNSr5koQt3/P6ijHYYUS1Ii0UzeFniEG569rcKST7HLux 7+QfP0GXrfB3Ev+FrKtQYpPajLXEtJ055s1Z6v7VPmi3pdk+PPQoDjiyFtZwdCSXGEk7cqzkvF/YH rzsh23YAWDePmcsP1FOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2az-0000000E6uX-0xJD; Sat, 09 Mar 2024 19:43:01 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2ao-0000000E6qK-36CB for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:52 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5683576ea18so1641540a12.3 for ; Sat, 09 Mar 2024 11:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013367; x=1710618167; darn=lists.infradead.org; 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=D8T0DrZMZzGxOnjyJe1X+PTbxVEPdeWgKDMMm+7dnlM=; b=FHo43NQWY91EQFIGRFvdN0PAeuykvoNpXJNZFYK5IPTFdwnUrKbZd8HR6FKTKVoWjh b/+CV6T8Dt47QPAKY2FlFd5p8W7gicTjKc3hun8bXlfHw8H4lHuTpidJHBFGmOUuj5NR 9rkUf8aXwCbDn7FZTfqvKmEJigEEsphhhhbqfa1ldM56NoJYok0kffJ7RsEx7TUywGRK IPHGINjoPQFxoMXp9SRISgEbbCAadUWbnjqRAmKZ2v1m9kS/evTerQGO0qXSZIjuCQ+j yA4yfWeis1HLJz+NquGqAJ40MslVjyd0lkNIB5DgGZJyVOZMMvr5hC1TO0YYc9Aitnlw /82Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013367; x=1710618167; 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=D8T0DrZMZzGxOnjyJe1X+PTbxVEPdeWgKDMMm+7dnlM=; b=XJDDbjzMWGdUXSGMWLeAQydFV6J0ZgnK7kuMssr+pURTyyqil6qCrRoGkhrmhsqCkT DqsAafJf1rY8qreO9nwUHu2zR7Z0XNBQyGkJi9i90wUhbBqg1pyfirFWcUdHZ9Hg9V6O LV4LdNcKFeKSP3pQnPvOvMDkKBxdobmKM+OdohSQ3HNVMIVYArqKgznP9vN+ksurSes1 vNLxfTpDDyVyKg61WbscEZc1NTOYiDeWnhwmUAFcTZZlzZLk1rigkQTO89MjwBypI0Ge 1HVFyZRYvC40/1LHHiZufRPocXvYuTfqftjSXAXKh4G8qm5LQLtM71OimDjV/KXbq1D4 tZUQ== X-Gm-Message-State: AOJu0YyQCrTylrJGKl653s+N16+BrjvKMtrd57CsDsboNf3Ha8c2LZ0m vAkIyYdRQoG9QE49CraF+evMK7Sxcby2kqrx3ZrOknikBN29e2QDNmPLa5B+ X-Google-Smtp-Source: AGHT+IFNQQ2etVvIid4A03j7SJ4ENAuua6k63ZUX6JR2PpdHuK099emQ2BplFNKcWeW1T3rqjVtszg== X-Received: by 2002:a50:9b58:0:b0:565:a6a4:2ecc with SMTP id a24-20020a509b58000000b00565a6a42eccmr1585108edj.2.1710013366978; Sat, 09 Mar 2024 11:42:46 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:46 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 5/7] tests: remotehost: ssh allow to skip user Date: Sat, 9 Mar 2024 20:42:26 +0100 Message-Id: <20240309194228.4186699-5-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> References: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114250_797622_C967AD21 X-CRM114-Status: GOOD ( 10.64 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Allow to skip user name when we run ssh user@hostname. We can specify user name in .ssh/config and simplify using network name spaces mapped per user. Eg. of .ssh/config Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52b listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Allow to skip user name when we run ssh user@hostname. We can specify user name in .ssh/config and simplify using network name spaces mapped per user. Eg. of .ssh/config Host localhost HostName localhost User root Host test1 HostName testpc User wlan1 Signed-off-by: Janusz Dziedzic --- tests/hwsim/remotehost.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/remotehost.py b/tests/hwsim/remotehost.py index d0efa210b..7bbf12d63 100644 --- a/tests/hwsim/remotehost.py +++ b/tests/hwsim/remotehost.py @@ -83,7 +83,10 @@ class Host(): if self.host is None: return self.local_execute(command) - cmd = ["ssh", self.user + "@" + self.host, ' '.join(command)] + if self.user: + cmd = ["ssh", self.user + "@" + self.host, ' '.join(command)] + else: + cmd = ["ssh", self.host, ' '.join(command)] _cmd = self.name + " execute: " + ' '.join(cmd) logger.debug(_cmd) err = tempfile.TemporaryFile() @@ -114,7 +117,10 @@ class Host(): if self.host is None: cmd = _command else: - cmd = ["ssh", self.user + "@" + self.host, ' '.join(_command)] + if self.user: + cmd = ["ssh", self.user + "@" + self.host, ' '.join(_command)] + else: + cmd = ["ssh", self.host, ' '.join(_command)] _cmd = self.name + " thread_run: " + ' '.join(cmd) logger.debug(_cmd) t = threading.Thread(target=execute_thread, name=filename, args=(cmd, res)) @@ -174,7 +180,10 @@ class Host(): _command = [filename] + command if self.host: - cmd = ["ssh", self.user + "@" + self.host, ' '.join(_command)] + if self.user: + cmd = ["ssh", self.user + "@" + self.host, ' '.join(_command)] + else: + cmd = ["ssh", self.host, ' '.join(_command)] else: cmd = _command @@ -261,12 +270,18 @@ class Host(): def get_logs(self, local_log_dir=None): for log in self.logs: if local_log_dir: - self.local_execute(["scp", self.user + "@[" + self.host + "]:" + log, local_log_dir]) + if self.user: + self.local_execute(["scp", self.user + "@[" + self.host + "]:" + log, local_log_dir]) + else: + self.local_execute(["scp", "[" + self.host + "]:" + log, local_log_dir]) self.execute(["rm", log]) del self.logs[:] def send_file(self, src, dst): if self.host is None: return - self.local_execute(["scp", src, - self.user + "@[" + self.host + "]:" + dst]) + if self.user: + self.local_execute(["scp", src, + self.user + "@[" + self.host + "]:" + dst]) + else: + self.local_execute(["scp", src, "[" + self.host + "]:" + dst]) From patchwork Sat Mar 9 19:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910131 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Ltd9mTwW; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=h3kNS0yx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD0mm8z23qt for ; Sun, 10 Mar 2024 06:43:28 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pPXxHfBCaWoEMnqUxnvdT15hgS3u4yL7S89Kijb3ezM=; b=Ltd9mTwWMZetvg SVVwUlKxh5tFldChUkAP9U+JULgTBskEO2s7UOJtUwfoj+YVtNqglLR67d3D4ELmh+RZ5cJa95pto ZUAc+NPhHHJtiOvznyvQpjq4k5U9gkPNj2jgNR232KpFv7w/iq5Ngk8DGKIAjYkGdoM4BZnzAUa6V PEokQiz/08IB5DR5XjqelMVFxEtRk/rKb0ggG9T4Tzd5PlYAloo7QfkA7bhGIJtt0WZsLzdf6drZe pHmSnSqONLl8NlGysdPgILzoWpvQ9GA0gbDTjAYCouY0CrAP7ndNYHNf0EcXL+38hRQSz2dAJ4eJh q00Wpk6N14/js5meyVvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2au-0000000E6td-1bYx; Sat, 09 Mar 2024 19:42:56 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2an-0000000E6qZ-3kyC for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:52 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d4141c4438so41549311fa.3 for ; Sat, 09 Mar 2024 11:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013368; x=1710618168; darn=lists.infradead.org; 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=VeKjN0GWn84ZZ2RKVwUW+OQ8hb4coDCUmrS4dt7Q6M8=; b=h3kNS0yxD/k+qph2peMu5bkd6aeGSxBLubAfIH9IxUBhNBIm3FuLBb4faV29kVRGjN 97xhzf7Y4g+/AFkMy9dRuQl68saQwMt+F/IvVUHewtPjySkdzw0mxt4UTFOQ3G3k6ERH /ryF9t7lWZWGm968eT/F6Ty9dPl/u4cgHDAJ6kq/aNuM2nAWGINkgIutuD+g5Ck7Iv/4 KEzKRdSZsP3YY6fGT3SMDsCsv7pqAxventz8txKVXGbjloP7+zAF0aURwhAFK5CUUpFr 7y+UjAsc5/CAn4uBh5SWA3Aq0apOj4hRDCbtTp1WvTlQqYbeAze7oykEZ8hlPtygFgQZ 1ohQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013368; x=1710618168; 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=VeKjN0GWn84ZZ2RKVwUW+OQ8hb4coDCUmrS4dt7Q6M8=; b=v9wD3GPvDE1JjfKJt3+FIYCYK+XmmkDnYNiS6EWKhkXqx1dwfFzI8190mVVGtnPg6u KTY0DSEg9Mxu/5sp7gM5dV60BIUwRppMJaCXcJu7WIKIOJ7zXMjLcz7+7q6cv4Bpi8yR Vd7novF+X0xX+LzsMITpOfEHZ8wMfUhd78oMl970FzI6BnPB7ZBhip49xmpD684dbGe3 Lqk6uwEREM+lzNuKEucdHqzGJbnTtmwfwKgNUJ9sI5BD2FIirs8mdJvV1r6hY1FPw+Pq II0eKUxFZ4F3XKpFoFI3sgw/88ypCT3C5SBJ6fmat+EOmx6cGq8AgWNu2eo2FkTrr54I oycg== X-Gm-Message-State: AOJu0YzugRf+IABvhLDBGXWF4hBnhi4eQMxVV7KJHQ1iQs/ZIahHFxlu Uxzqeo7LxUlQnPYqk2ThK9zy4Pj/DU02K5+hNGoZ3KxStzNovKo3MUd+iTUu X-Google-Smtp-Source: AGHT+IF0l1R/TSB3xBOZfTeirCanqT2FL+rUBTnkCkg5aTb5FaFbVDvzTs8yIzYUfa74mLSIr6iVpA== X-Received: by 2002:a2e:a48a:0:b0:2d3:24cb:f273 with SMTP id h10-20020a2ea48a000000b002d324cbf273mr1298185lji.36.1710013367656; Sat, 09 Mar 2024 11:42:47 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:47 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 6/7] tests: remote: use remote_cli Date: Sat, 9 Mar 2024 20:42:27 +0100 Message-Id: <20240309194228.4186699-6-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> References: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114250_018574_D48539A8 X-CRM114-Status: GOOD ( 11.30 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This allow to use remote wpa/hostapd cli for: - hwsim wrapper - example test case Eg. modprobe mac80211_hwsim radios=8 ./run-tests.py -d hwsim0 -d hwsim1 -d hwsim2 -r hwsim3 -r hwsim4 -h ap_wpa2_psk -v Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:234 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This allow to use remote wpa/hostapd cli for: - hwsim wrapper - example test case Eg. modprobe mac80211_hwsim radios=8 ./run-tests.py -d hwsim0 -d hwsim1 -d hwsim2 -r hwsim3 -r hwsim4 -h ap_wpa2_psk -v Signed-off-by: Janusz Dziedzic --- tests/remote/config.py | 1 + tests/remote/hwsim_wrapper.py | 4 ++-- tests/remote/rutils.py | 34 ++++++++++++++++++++++++++++++++-- tests/remote/test_example.py | 5 +++-- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/tests/remote/config.py b/tests/remote/config.py index 1ac362ead..f051ddcd8 100644 --- a/tests/remote/config.py +++ b/tests/remote/config.py @@ -24,6 +24,7 @@ setup_params = {"setup_hw" : "./tests/setup_hw.sh", "wlantest_cli" : "./tests/wlantest_cli", "country" : "US", "log_dir" : "/tmp/", + "remote_cli" : True, "ipv4_test_net" : "192.168.12.0", "trace_start" : "./tests/trace_start.sh", "trace_stop" : "./tests/trace_stop.sh", diff --git a/tests/remote/hwsim_wrapper.py b/tests/remote/hwsim_wrapper.py index 38f927f6e..a2eb2566f 100644 --- a/tests/remote/hwsim_wrapper.py +++ b/tests/remote/hwsim_wrapper.py @@ -58,8 +58,8 @@ def run_hwsim_test(devices, setup_params, refs, duts, monitors, hwsim_test): # run hostapd/wpa_supplicant for ref_host in ref_hosts: rutils.run_wpasupplicant(ref_host, setup_params) - wpas = WpaSupplicant(hostname=ref_host.host, global_iface="udp", - global_port=ref_host.port) + wpas = WpaSupplicant(hostname=ref_host.host, global_iface=ref_host.global_iface, + global_port=ref_host.port, remote_cli=ref_host.remote_cli) wpas.interface_add(ref_host.ifname) dev.append(wpas) for dut_host in dut_hosts: diff --git a/tests/remote/rutils.py b/tests/remote/rutils.py index 690299112..6ceb41429 100644 --- a/tests/remote/rutils.py +++ b/tests/remote/rutils.py @@ -106,6 +106,7 @@ def perf_start_stop(host, setup_params, start): # hostapd/wpa_supplicant helpers def run_hostapd(host, setup_params): log_file = None + remote_cli = False try: tc_name = setup_params['tc_name'] log_dir = setup_params['log_dir'] @@ -118,12 +119,27 @@ def run_hostapd(host, setup_params): if log_file: host.add_log(log_file) pidfile = setup_params['log_dir'] + "hostapd_" + host.ifname + "_" + setup_params['tc_name'] + ".pid" - status, buf = host.execute([setup_params['hostapd'], "-B", "-ddt", "-g", "udp:" + host.port, "-P", pidfile, log]) + + if 'remote_cli' in setup_params: + remote_cli = setup_params['remote_cli'] + + if remote_cli: + ctrl_global_path = '/var/run/hapd-global' + '-' + host.ifname + host.global_iface = ctrl_global_path + host.dev['remote_cli'] = True + host.dev['global_ctrl_override'] = ctrl_global_path + else: + ctrl_global_path = "udp:" + host.port + host.global_iface = "udp" + host.dev['remote_cli'] = False + + status, buf = host.execute([setup_params['hostapd'], "-B", "-ddt", "-g", ctrl_global_path, "-P", pidfile, log]) if status != 0: raise Exception("Could not run hostapd: " + buf) def run_wpasupplicant(host, setup_params): log_file = None + remote_cli = False try: tc_name = setup_params['tc_name'] log_dir = setup_params['log_dir'] @@ -136,7 +152,21 @@ def run_wpasupplicant(host, setup_params): if log_file: host.add_log(log_file) pidfile = setup_params['log_dir'] + "wpa_supplicant_" + host.ifname + "_" + setup_params['tc_name'] + ".pid" - status, buf = host.execute([setup_params['wpa_supplicant'], "-B", "-ddt", "-g", "udp:" + host.port, "-P", pidfile, log]) + + if 'remote_cli' in setup_params: + remote_cli = setup_params['remote_cli'] + + if remote_cli: + ctrl_global_path = '/var/run/wpas-global' + "-" + host.ifname + host.global_iface = ctrl_global_path + host.remote_cli = True + + if not remote_cli: + ctrl_global_path = "udp:" + host.port + host.global_iface = "udp" + host.remote_cli = False + + status, buf = host.execute([setup_params['wpa_supplicant'], "-B", "-ddt", "-g", ctrl_global_path, "-P", pidfile, log]) if status != 0: raise Exception("Could not run wpa_supplicant: " + buf) diff --git a/tests/remote/test_example.py b/tests/remote/test_example.py index 1550665c3..65bc01bc4 100644 --- a/tests/remote/test_example.py +++ b/tests/remote/test_example.py @@ -58,8 +58,9 @@ def test_example(devices, setup_params, refs, duts, monitors): # connect to hostapd/wpa_supplicant UDP CTRL iface hapd = hostapd.add_ap(ap.dev, ap_params) freq = hapd.get_status_field("freq") - wpas = WpaSupplicant(hostname=sta.host, global_iface="udp", - global_port=sta.port) + + wpas = WpaSupplicant(hostname=sta.host, global_iface=sta.global_iface, + global_port=sta.port, remote_cli=sta.remote_cli) wpas.interface_add(sta.ifname) # setup standalone monitor based on hapd; could be multi interface From patchwork Sat Mar 9 19:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 1910134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=L5K/9akz; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=mgT501kt; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TsYPD0W1Mz1yX6 for ; Sun, 10 Mar 2024 06:43:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OthnncpfPfqBI6cwpcWAVlvXSNfH0/E1Q30NXC72L7w=; b=L5K/9akzgEyrVW lT+wNwtlYBUoA9f1nWLTp84Y/gwvNyMjcijJ6nxlwlGwxRWdFiwsYhx5jr+4OvVFEGAd+7AedFJkJ L+OOErldhf7Ywxwy6k0ruvggYniYxEkWXqFhenvNDm2i+5B366zn7NZV7m27cI2qgZNkhHqOuUnlV VWfnMODx0yJH41xMI9EOjp4ZcazWPKwutaYtNif882156F+frtIA8wldZW4IyDgI7fI6I96GI9d4W MStIlezcuDGDRm6tscnqqoom9pTT+JlFK3/M3M4jzsubzALfBpNlhTyvyol7vQaTiAtRUq1EB72Rj 31Lczebcpi9cMQMlLQOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2aw-0000000E6u5-3wNA; Sat, 09 Mar 2024 19:42:58 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rj2ao-0000000E6qc-0vU8 for hostap@lists.infradead.org; Sat, 09 Mar 2024 19:42:52 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-568241f40e9so2390917a12.0 for ; Sat, 09 Mar 2024 11:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710013368; x=1710618168; darn=lists.infradead.org; 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=89y8uR3PIKXih+y0BO4uKJZluLGezM5c1oasCiItlb8=; b=mgT501ktHAxM3d/sIuw9m3UcZ+2CufnD3KAGvM35uAF1I8p2ccl5JemD0f5F0BNja1 OaiaqrshDTr8YzNBp/dlFGP1tZtLicBB5OyZvnqnYl1KeaR8HpJbGgn9RlQTG1rhaP4a 2gkdVMHc17GSAOybJwenbCH31FwmsTMbUzTmrTXkqpyx+JegMDdWFGwg3kDvE4UUs8kG JVA86F73qo/OiYOCq7AOw0Ht9QkkUKzPWOZa/OJ5Z0o8SNkcocjVgIXKt08STR6tn/RE IAnaA2BkSteZyUjfylpLnxwmKtuhr6CzTMhsBdk6snMp16IbsCHxoCxdwzK5L+YDipoz 9ElA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710013368; x=1710618168; 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=89y8uR3PIKXih+y0BO4uKJZluLGezM5c1oasCiItlb8=; b=g0hxYdXCQFVuW1g6ELPbdUGIVgu6iqCp8U9ELwlhuymeno/iHb6UmojoOjqdplBUjG 5XE1nZG9hBpiqZKNDyW//dPqyqaKPhRSjxe6ua+jdA+cHVQJndiTbKsSB+xwM5ZIb857 yNJGhuesCPbq6/05pJH2JDGSqxMyihJ5CxbvUt0OtEaVIsfoB5bSRiiPQc/MV3qdAsbN 4hy5XSqWeY5911tjpM8c/e3Yjv0+7bQJmwSfnMXuNTggeujGhj9BRSnzVrY1JOwxUlCV W58tcaWMPZBsdkNusur0uRU7ojTRjl0TQzt1A1kDA3MZee+XqeC04RBcdWI2y+ZKNHPt 1lXw== X-Gm-Message-State: AOJu0YwUjZ8ainf/+OONuRQyomziqTvi8fcYGO+J3TS68evB4hZhXEw6 iG3CCL4UchsCMtnR0B3zYehG2xjDUNANbLTOMuNNbxb44EktXu2nFTi0dhfo X-Google-Smtp-Source: AGHT+IHNCQa2eYCpJ0n0ftEd7Vh0v7s81Hs7gTOXNta6YaSYhcipM8skllVrf4LrUuDBOOi0wxRBYg== X-Received: by 2002:a50:cdd5:0:b0:567:6ae0:7bbe with SMTP id h21-20020a50cdd5000000b005676ae07bbemr1751710edj.24.1710013368300; Sat, 09 Mar 2024 11:42:48 -0800 (PST) Received: from e850.lan ([62.141.192.106]) by smtp.gmail.com with ESMTPSA id y2-20020aa7c242000000b0056740ba5eb0sm1206107edo.37.2024.03.09.11.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 11:42:48 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Cc: j@w1.fi, Janusz Dziedzic Subject: [PATCH 7/7] wpa_cli: don't select iface when global Date: Sat, 9 Mar 2024 20:42:28 +0100 Message-Id: <20240309194228.4186699-7-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> References: <20240309194228.4186699-1-janusz.dziedzic@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240309_114250_334437_DD0B86B7 X-CRM114-Status: GOOD ( 10.71 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In case we run command like: wpa_cli -g command don't print "Selected interface " message. Signed-off-by: Janusz Dziedzic --- wpa_supplicant/wpa_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:533 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [janusz.dziedzic(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In case we run command like: wpa_cli -g command don't print "Selected interface " message. Signed-off-by: Janusz Dziedzic --- wpa_supplicant/wpa_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c index b1334e2e6..54d6505b4 100644 --- a/wpa_supplicant/wpa_cli.c +++ b/wpa_supplicant/wpa_cli.c @@ -5129,7 +5129,7 @@ int main(int argc, char *argv[]) eloop_register_signal_terminate(wpa_cli_terminate, NULL); - if (ctrl_ifname == NULL) + if (ctrl_ifname == NULL && !global) ctrl_ifname = wpa_cli_get_default_ifname(); if (reconnect && action_file && ctrl_ifname) {