From patchwork Wed Aug 22 13:46:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 960878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="N59aIcRC"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41wN9D4t2Wz9s3x for ; Wed, 22 Aug 2018 19:51:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=HhJm25mxcmD+NN+//s6i89J7r5pgjwwDghpDB9izGe8=; b=N59 aIcRCVudDbgTH1A82WxhKMNyzIvFLrFVJ0wDCTJeXdTsNJnWLXV60bsYgEOwKnLx0ocuyB5gLq7XT nLF7UJCzQF+spf6rv/OwrtZ8NERpfClaXuaa+yoWMwYXeeIs+CjY4ibxiJmkRVds5uEF+RjR5/vFw nM3phHZPacVM57g/skDWTvUefuvkvdc7gGBlHrssDuQwRebZWKi7cwkxTwYuyjtPaOOIu24GryLjw r620KkEAIL2qaHCyp7RP49qOeRMRuDCR4KP5D2Khw274zxsFCprThy29rVlalbC0DK2IRVOnAnxC7 SheFeRHZt8JhtOoLTeb7dx2PdETmupA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsPnP-0003Rj-D4; Wed, 22 Aug 2018 09:51:23 +0000 Received: from mga17.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsPn3-0002wU-IJ for hostap@lists.infradead.org; Wed, 22 Aug 2018 09:51:03 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Aug 2018 02:50:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,273,1531810800"; d="scan'208";a="83930244" Received: from unknown (HELO andrei-XPS-12-9Q33.ger.corp.intel.com) ([10.12.217.183]) by orsmga001.jf.intel.com with ESMTP; 22 Aug 2018 02:50:54 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH 4/5] tests: Beacon report last frame indication Date: Wed, 22 Aug 2018 16:46:20 +0300 Message-Id: <1534945581-27527-4-git-send-email-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180822_025101_703850_1D04CB59 X-CRM114-Status: GOOD ( 11.38 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Avraham Stern MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Avraham Stern Verify that the beacon report contains the last beacon report indication subelement when requested in the beacon request. Signed-off-by: Avraham Stern --- tests/hwsim/test_rrm.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/hwsim/test_rrm.py b/tests/hwsim/test_rrm.py index ffd647b..611b444 100644 --- a/tests/hwsim/test_rrm.py +++ b/tests/hwsim/test_rrm.py @@ -706,6 +706,7 @@ class BeaconReport: self.subelems = report self.frame_body = None self.frame_body_fragment_id = None + self.last_indication = None while len(report) >= 2: eid,elen = struct.unpack('BB', report[0:2]) report = report[2:] @@ -722,6 +723,8 @@ class BeaconReport: self.frame_body = report[0:elen] if eid == 2: self.frame_body_fragment_id = report[0:elen] + if eid == 164: + self.last_indication = report[0:elen] report = report[elen:] def __str__(self): txt = "opclass={} channel={} start={} duration={} frame_info={} rcpi={} rsni={} bssid={} antenna_id={} parent_tsf={}".format(self.opclass, self.channel, self.start, self.duration, self.frame_info, self.rcpi, self.rsni, self.bssid_str, self.antenna_id, self.parent_tsf) @@ -729,6 +732,9 @@ class BeaconReport: txt += " frame_body=" + binascii.hexlify(self.frame_body) if self.frame_body_fragment_id: txt += " fragment_id=" + binascii.hexlify(self.frame_body_fragment_id) + if self.last_indication: + txt += " last_indication=" + binascii.hexlify(self.last_indication) + return txt def run_req_beacon(hapd, addr, request): @@ -837,6 +843,62 @@ def test_rrm_beacon_req_frame_body_fragmentation(dev, apdev): if i == 1 and more_frags != 0: raise Exception("more fragments bit is set on last fragment") +def test_rrm_beacon_req_last_frame_indication(dev, apdev): + """Beacon request - beacon table mode - last frame indication""" + params = { "ssid": "rrm", "rrm_beacon_report": "1" } + + hapd = hostapd.add_ap(apdev[0], params) + hapd2 = hostapd.add_ap(apdev[1], { "ssid": "another" }) + + dev[0].connect("rrm", key_mgmt="NONE", scan_freq="2412") + addr = dev[0].own_addr() + + # The request contains the last beacon report indication subelement + token = run_req_beacon(hapd, addr, "51000000000002ffffffffffffa40101") + + for i in range(1, 3): + ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=10) + if ev is None: + raise Exception("Beacon report %d response not received" % i) + fields = ev.split(' ') + if fields[1] != addr: + raise Exception("Unexpected STA address in beacon report response: " + fields[1]) + if fields[2] != token: + raise Exception("Unexpected dialog token in beacon report response: " + fields[2] + " (expected " + token + ")") + if fields[3] != "00": + raise Exception("Unexpected measurement report mode") + + report = BeaconReport(binascii.unhexlify(fields[4])) + logger.info("Received beacon report: " + str(report)) + + if not report.last_indication: + raise Exception("Last Beacon Report Indication subelement missing") + + last = binascii.hexlify(report.last_indication) + if last != '01': + raise Exception("last beacon report indication is not set on last frame") + + # The request does not contain the last beacon report indication subelement + token = run_req_beacon(hapd, addr, "51000000000002ffffffffffff") + + for i in range(1, 3): + ev = hapd.wait_event(["BEACON-RESP-RX"], timeout=10) + if ev is None: + raise Exception("Beacon report %d response not received" % i) + fields = ev.split(' ') + if fields[1] != addr: + raise Exception("Unexpected STA address in beacon report response: " + fields[1]) + if fields[2] != token: + raise Exception("Unexpected dialog token in beacon report response: " + fields[2] + " (expected " + token + ")") + if fields[3] != "00": + raise Exception("Unexpected measurement report mode") + + report = BeaconReport(binascii.unhexlify(fields[4])) + logger.info("Received beacon report: " + str(report)) + + if report.last_indication: + raise Exception("Last Beacon Report Indication subelement present but not requested") + @remote_compatible def test_rrm_beacon_req_table_detail(dev, apdev): """Beacon request - beacon table mode - reporting detail"""