test_offchannel_tx.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # cfg80211 offchannel TX using remain-on-channel
  2. # Copyright (c) 2014, Jouni Malinen <j@w1.fi>
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import logging
  7. logger = logging.getLogger()
  8. import hostapd
  9. from wpasupplicant import WpaSupplicant
  10. from test_gas import start_ap
  11. from test_gas import anqp_get
  12. from p2p_utils import *
  13. def test_offchannel_tx_roc_gas(dev, apdev):
  14. """GAS using cfg80211 remain-on-channel for offchannel TX"""
  15. start_ap(apdev[0])
  16. bssid = apdev[0]['bssid']
  17. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  18. wpas.interface_add("wlan5", drv_params="no_offchannel_tx=1")
  19. wpas.flush_scan_cache()
  20. wpas.scan_for_bss(bssid, freq=2412)
  21. anqp_get(wpas, bssid, 263)
  22. ev = wpas.wait_event(["GAS-QUERY-DONE"], timeout=10)
  23. if ev is None:
  24. raise Exception("GAS query timed out")
  25. if "result=SUCCESS" not in ev:
  26. raise Exception("Unexpected GAS query result")
  27. def test_offchannel_tx_roc_grpform(dev, apdev):
  28. """P2P group formation using cfg80211 remain-on-channel for offchannel TX"""
  29. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  30. wpas.interface_add("wlan5", drv_params="no_offchannel_tx=1")
  31. [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_freq=2412,
  32. r_dev=wpas, r_freq=2412)
  33. check_grpform_results(i_res, r_res)
  34. remove_group(dev[0], wpas)
  35. def test_offchannel_tx_roc_grpform2(dev, apdev):
  36. """P2P group formation(2) using cfg80211 remain-on-channel for offchannel TX"""
  37. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  38. wpas.interface_add("wlan5", drv_params="no_offchannel_tx=1")
  39. [i_res, r_res] = go_neg_pin_authorized(i_dev=wpas, i_freq=2412,
  40. r_dev=dev[0], r_freq=2412)
  41. check_grpform_results(i_res, r_res)
  42. remove_group(dev[0], wpas)