From patchwork Wed Feb 17 12:14:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 584106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A575E140082 for ; Wed, 17 Feb 2016 23:16:22 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=tieto.com header.i=@tieto.com header.b=cQjmcs8b; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aW11i-0000k4-8E; Wed, 17 Feb 2016 12:16:14 +0000 Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aW113-0007ig-O6 for hostap@lists.infradead.org; Wed, 17 Feb 2016 12:15:40 +0000 Received: by mail-lb0-x22f.google.com with SMTP id of3so8277601lbc.1 for ; Wed, 17 Feb 2016 04:15:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Fh5zkqQYWAoUTEuooJFsx6Q3B6diEaPOJwLUo+h+e6A=; b=cQjmcs8bocP7VFwacIJbcMGQKlJx/z5HsEmKBVpCrQQxPWPMfSe/Kti5H0XJ2E4kc/ CIrBH2fKwbIYr9t98bzJazoZZL+xQiguH6eMCz++q8641+/nbVldM/WvssGAkth5u4ZY X5F725xrVbWT1C9yCELhVbtHcItPJt1b9BOXY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Fh5zkqQYWAoUTEuooJFsx6Q3B6diEaPOJwLUo+h+e6A=; b=egOa6ArJXo+8arEtShyzCuSXw7tAwpsXm522d4DoC03crDKZoRZVwYmz37MRBzTAAM xIre+ici8kAO4d8PboU4cSzGrsgx26Mc4wHP9LlfgQGoZUjBVDLwnsYqss9mLj24WHAf ogJv5aYK9myJEX9QaYHNYkjJ2sfI9Gpscfe5nVaGqQdMlKc3IDNSOaPLjdUtaMGLfDWx cwYolvDot0o2zgfRbtFx/IWJObh4eCZ5Lxe1fMsrOIpBqV/opQ+V6OvdWlbQWSxjq/Tc AFbBj71slrqtnJ77LJ4t41F1BQ5fN08Bi+u97PsJ7+BsLlcaCmsaKSQAElnWwmy4S/BI y9hQ== X-Gm-Message-State: AG10YORiyEOsBw76zG2paoARVHR1ULd+QQETPPNN3v9u9Yatnjs5kXpAfyqZYUT8leqWaNi5jlEDZLC2iXjQ8yJELGRlTeYogCYYMNYI+EmxAtFkbZIFjAVg6ZdlQUjmUdtWN1uuaYOLkajCgoCIF4ctZVX9XVHgqJPKGdRZXJNT3CZLzPiLltpkwHIfFlfRNG5y X-Received: by 10.112.201.202 with SMTP id kc10mr612638lbc.33.1455711311836; Wed, 17 Feb 2016 04:15:11 -0800 (PST) Received: from dell6430.guest.wifi ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id t5sm169075lbg.15.2016.02.17.04.15.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 04:15:10 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH v3 25/26] tests: add terminate support for hostapd/wpa_supplicant Date: Wed, 17 Feb 2016 13:14:28 +0100 Message-Id: <1455711269-12929-26-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455711269-12929-1-git-send-email-janusz.dziedzic@tieto.com> References: <1455711269-12929-1-git-send-email-janusz.dziedzic@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160217_041534_292255_4CFED087 X-CRM114-Status: UNSURE ( 8.03 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c04:0:0:0:22f listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j@w1.fi, Janusz Dziedzic MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Janusz Dziedzic --- tests/hwsim/hostapd.py | 20 ++++++++++++++++++++ tests/hwsim/wpasupplicant.py | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py index 6e0bf37..f36704d 100644 --- a/tests/hwsim/hostapd.py +++ b/tests/hwsim/hostapd.py @@ -102,6 +102,13 @@ class HostapdGlobal: words = line.split(":") return int(words[1]) + def terminate(self): + self.mon.detach() + self.mon.close() + self.mon = None + self.ctrl.terminate() + self.ctrl = None + class Hostapd: def __init__(self, ifname, bssidx=0, hostname=None, port=8877): self.host = wpaspy.Host(hostname, ifname) @@ -117,6 +124,14 @@ class Hostapd: self.bssid = None self.bssidx = bssidx + def close_ctrl(self): + if self.mon is not None: + self.mon.detach() + self.mon.close() + self.mon = None + self.ctrl.close() + self.ctrl = None + def own_addr(self): if self.bssid is None: self.bssid = self.get_status_field('bssid[%d]' % self.bssidx) @@ -366,6 +381,11 @@ def remove_bss(ifname, hostname=None, port=8878): hapd_global = HostapdGlobal(hostname=hostname, port=port) hapd_global.remove(ifname) +def terminate(hostname=None, port=8878): + logger.info("Terminating hostapd") + hapd_global = HostapdGlobal(hostname=hostname, port=port) + hapd_global.terminate() + def wpa2_params(ssid=None, passphrase=None): params = { "wpa": "2", "wpa_key_mgmt": "WPA-PSK", diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index fc46992..381c4b1 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -39,6 +39,13 @@ class WpaSupplicant: else: self.global_mon = None + def terminate(self): + if self.global_mon: + self.global_mon.detach() + self.global_mon = None + self.global_ctrl.terminate() + self.global_ctrl = None + def close_ctrl(self): if self.global_mon: self.global_mon.detach()