From d27f1acbfaaa59b547a1434b61e0cd62b460922f Mon Sep 17 00:00:00 2001
From: Jouni Malinen <jouni@codeaurora.org>
Date: Fri, 24 May 2019 17:06:44 +0300
Subject: [PATCH] tests: Preferred Candidate List with truncated BSS
 Termination Duration

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
---
 tests/hwsim/test_wnm.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/hwsim/test_wnm.py b/tests/hwsim/test_wnm.py
index 07d18702a..66d74c351 100644
--- a/tests/hwsim/test_wnm.py
+++ b/tests/hwsim/test_wnm.py
@@ -691,6 +691,19 @@ def test_wnm_bss_tm_req(dev, apdev):
     resp = rx_bss_tm_resp(hapd, expect_dialog=8, expect_status=7)
     dev[0].dump_monitor()
 
+    # Preferred Candidate List with truncated BSS Termination Duration
+    # WNM: Too short BSS termination duration
+    req = bss_tm_req(addr, apdev[0]['bssid'],
+                     req_mode=0x01, dialog_token=8)
+    # BSS Termination Duration (truncated)
+    subelems = struct.pack("<BBQB", 4, 9, 0, 10)
+    req['payload'] += struct.pack("<BB6BLBBB", 52, 13 + len(subelems),
+                                  1, 2, 3, 4, 5, 6,
+                                  0, 81, 1, 7) + subelems
+    hapd.mgmt_tx(req)
+    resp = rx_bss_tm_resp(hapd, expect_dialog=8, expect_status=7)
+    dev[0].dump_monitor()
+
     # Preferred Candidate List followed by vendor element
     req = bss_tm_req(addr, apdev[0]['bssid'],
                      req_mode=0x01, dialog_token=8)