test_wext.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Deprecated WEXT driver interface in wpa_supplicant
  2. # Copyright (c) 2013, 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 os
  9. import hostapd
  10. import hwsim_utils
  11. from wpasupplicant import WpaSupplicant
  12. def test_wext_open(dev, apdev):
  13. """WEXT driver interface with open network"""
  14. if not os.path.exists("/proc/net/wireless"):
  15. logger.info("WEXT support not included in the kernel")
  16. return "skip"
  17. params = { "ssid": "wext-open" }
  18. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  19. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  20. try:
  21. wpas.interface_add("wlan5", driver="wext")
  22. except Exception, e:
  23. logger.info("WEXT driver support not included in wpa_supplicant")
  24. return "skip"
  25. wpas.connect("wext-open", key_mgmt="NONE")
  26. hwsim_utils.test_connectivity(wpas, hapd)
  27. def test_wext_wpa2_psk(dev, apdev):
  28. """WEXT driver interface with WPA2-PSK"""
  29. if not os.path.exists("/proc/net/wireless"):
  30. logger.info("WEXT support not included in the kernel")
  31. return "skip"
  32. params = hostapd.wpa2_params(ssid="wext-wpa2-psk", passphrase="12345678")
  33. hapd = hostapd.add_ap(apdev[0]['ifname'], params)
  34. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  35. try:
  36. wpas.interface_add("wlan5", driver="wext")
  37. except Exception, e:
  38. logger.info("WEXT driver support not included in wpa_supplicant")
  39. return "skip"
  40. wpas.connect("wext-wpa2-psk", psk="12345678")
  41. hwsim_utils.test_connectivity(wpas, hapd)