From patchwork Fri Mar 4 09:20:40 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: 591863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 7094B1402A8 for ; Fri, 4 Mar 2016 20:26:17 +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=XJfC9rK9; 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 1ablzv-00057v-Al; Fri, 04 Mar 2016 09:26:11 +0000 Received: from mail-lb0-x22a.google.com ([2a00:1450:4010:c04::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ablvV-0001pB-EJ for hostap@lists.infradead.org; Fri, 04 Mar 2016 09:21:41 +0000 Received: by mail-lb0-x22a.google.com with SMTP id k15so54128333lbg.0 for ; Fri, 04 Mar 2016 01:21:18 -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=RSMalWJOcwt2MkmWjOk7rbECi3ACzyp8NOb+wtJ1n1E=; b=XJfC9rK9Y+lnKTkCILrsmuL9uYI0BGW6yxyfwtLSpk/Fzqy208OF02rmXL+sqZnNOW WbjJsH1MWvHt7loVaBq0Y5qgveBURgHRbZjpnnfBbtVb0hMBoQuM2L5GbWXVY1LcgMwR EAjtiniKOtWHwXafe27qwUMcK7dXok0EBTi5c= 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=RSMalWJOcwt2MkmWjOk7rbECi3ACzyp8NOb+wtJ1n1E=; b=DfImpYfwX3SBsUUEQe0yRFBuPvrY+I3QirmR6/ckRVRVe83ByIMYN7LBe0myGn5hiR JtgEXUH82Yv7E1T93s7qP4Mqitak32DCZwhDJJgOugOIus5AN4kEMO4hH/U2P/wXIfcP X2qOzTNeEGWYY8GBb5QS1Su+db32sHEe/pUHMnN6cg1KAPWnYY0An3nIwBlFUyfiJ6ca +UpFVq3r/sKngh93nnt4U2s1uZ4N1+JI4NJ0dpexzTlWbkaPC4JbM6KLM2q0JQqekR9A S1bQuFbw8VCzqICn+YiZHr6CNjzD8QNB6DaPh2QIrPtPecNZQtmUyy8iV7qVq81uUHuF zPlg== X-Gm-Message-State: AD7BkJItnBlTIfhTJR2y4riGoO0b/MQY5U87JRtFGXQzOxLq1HplkIZC25b6c0SBXuLwyqy6Xt1g/MyqnJF9FXx/e6FeABCqpGg0ff3VhN78RXPVb5qM1VDEAAPfrkMTrOlRXd36cWrfxkucao5LiFgP7ttHdLQLOutT8iDQ8VKseRgP0Vg0+0G09klE+yf2KCGM X-Received: by 10.25.42.72 with SMTP id q69mr2596788lfq.53.1457083276638; Fri, 04 Mar 2016 01:21:16 -0800 (PST) Received: from dell6430.guest.wifi ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id r191sm437001lfe.28.2016.03.04.01.21.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 01:21:16 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH v5 24/25] tests: add terminate support for hostapd/wpa_supplicant Date: Fri, 4 Mar 2016 10:20:40 +0100 Message-Id: <1457083241-7492-25-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1457083241-7492-1-git-send-email-janusz.dziedzic@tieto.com> References: <1457083241-7492-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-20160304_012137_964438_D7186F45 X-CRM114-Status: UNSURE ( 8.13 ) 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:22a 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 e4d6bc8..3efebb9 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 de814be..b167772 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()