From patchwork Fri Feb 26 09:38:32 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: 588739 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 B06AB1402A8 for ; Fri, 26 Feb 2016 20:50:46 +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=fPKP302u; 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 1aZF2k-00032E-Ma; Fri, 26 Feb 2016 09:50:38 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aZF2f-0002l2-32 for hostap@bombadil.infradead.org; Fri, 26 Feb 2016 09:50:33 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by casper.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1aZEs8-0002vA-1G for hostap@lists.infradead.org; Fri, 26 Feb 2016 09:39:41 +0000 Received: by mail-wm0-x236.google.com with SMTP id b205so64710915wmb.1 for ; Fri, 26 Feb 2016 01:39: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=k4gQi0t2O56fn499z70GHlDM9k7Xu0YRZ+9/4q1OL48=; b=fPKP302uWG4nfexxJI5vzqbHugemPtcOPMAbsa2NibGMYrNyyX8ZFDm2N/nidLe+5h L9vEnZ1urnjjtyIv06S1REdlVcDVTfsWBOn6xs2Q5ec82bxTcCFQX2n17yiYf5xRWKIY L8tEff+qsJjymrwHFqXVpP3YsGPMhyx2eUjZU= 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=k4gQi0t2O56fn499z70GHlDM9k7Xu0YRZ+9/4q1OL48=; b=SaJByaRdY9zmfk/ZGpmxLoCTmqoSOhVehlrzRLfluQbsM2G/ILZR92i6uXRWqi85+g nw8xYGldBlZgKQlSbN99HeXA/ocAPIRt47Sn1Dw680ny9USwIAfekN7iFA3rExMnPH4c PssIHBrMgbrL3gPUp2W4g0+kF9sWKooaW/h1Rob1tO2io8NfUfPYo+jCAAm5aPs2JXG2 fpcMSyxpe6gXT9VD8nfoStxRnIxpWxeXxtNueFjBY28oexMRGyLuNUrmQAVe+viHP7Cs JCOBldNadA2SMZcs+2WcR7JU9XsmASzEVODAnXWe7iMR/i/TUd13zmnO/T/LzKwTwqO9 jXKQ== X-Gm-Message-State: AD7BkJLEPtdeV4ubVW+6KsRZeLNgPWFSQiVzA8TxW1MEsPnl+gXUT0xLWtP0LdC1ucF3Q1IDQomPnI53ZTuWy5FOdNDwDlzvCbxD1TlAzsjJW30VHvJzcpLUvcZ/mSkUdQRen1X5TYIXz1ajXkUnxq0AtnVsJwpQO/XqElldiLp3WWfMOcYX+AFwhLs4RjcuKfMD X-Received: by 10.28.158.8 with SMTP id h8mr2128274wme.6.1456479557737; Fri, 26 Feb 2016 01:39:17 -0800 (PST) Received: from dell6430.guest.wifi ([91.198.246.8]) by smtp.gmail.com with ESMTPSA id z65sm1915950wmg.1.2016.02.26.01.39.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Feb 2016 01:39:17 -0800 (PST) From: Janusz Dziedzic To: hostap@lists.infradead.org Subject: [PATCH v4 17/29] wpaspy: add debug support for Ctrl UDP class Date: Fri, 26 Feb 2016 10:38:32 +0100 Message-Id: <1456479524-14185-18-git-send-email-janusz.dziedzic@tieto.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456479524-14185-1-git-send-email-janusz.dziedzic@tieto.com> References: <1456479524-14185-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-20160226_093940_136265_0FA17716 X-CRM114-Status: UNSURE ( 9.87 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on casper.infradead.org summary: Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:236 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 Add debug support for Ctrl class. This is useful for debuging purpose for UDP connection. Signed-off-by: Janusz Dziedzic --- wpaspy/wpaspy.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wpaspy/wpaspy.py b/wpaspy/wpaspy.py index 30bb652..76ac785 100644 --- a/wpaspy/wpaspy.py +++ b/wpaspy/wpaspy.py @@ -10,7 +10,9 @@ import os import stat import socket import select +import logging +logger = logging.getLogger() counter = 0 class Ctrl: @@ -54,7 +56,7 @@ class Ctrl: self.cookie = reply self.port = port except: - print "connect exception ", path, str(port) + logger.debug("connect exception " + str(path) + "/" + str(port)) if self.s != None: self.s.close() raise @@ -79,12 +81,13 @@ class Ctrl: def request(self, cmd, timeout=10): if self.udp == True: + logger.debug(self.path + "/" + str(self.port) + " request: " + cmd) self.s.sendto(self.cookie + cmd, self.sockaddr) else: self.s.send(cmd) [r, w, e] = select.select([self.s], [], [], timeout) if r: - return self.s.recv(4096) + return self.recv() raise Exception("Timeout on waiting response") def attach(self): @@ -115,4 +118,6 @@ class Ctrl: def recv(self): res = self.s.recv(4096) + if self.udp == True: + logger.debug(self.path + "/" + str(self.port) + " recv: " + res) return res