test_wext.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. # It did not look like open mode association completed with WEXT.. Commenting
  13. # this test case out for now. If you care about WEXT, feel free to fix it and
  14. # submit a patch to remove the "REMOVED_" prefix here..
  15. def REMOVED_test_wext_open(dev, apdev):
  16. """WEXT driver interface with open network"""
  17. if not os.path.exists("/proc/net/wireless"):
  18. logger.info("WEXT support not included in the kernel")
  19. return "skip"
  20. params = { "ssid": "wext-open" }
  21. hostapd.add_ap(apdev[0]['ifname'], params)
  22. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  23. try:
  24. wpas.interface_add("wlan5", driver="wext")
  25. except Exception, e:
  26. logger.info("WEXT driver support not included in wpa_supplicant")
  27. return "skip"
  28. wpas.connect("wext-open", key_mgmt="NONE")
  29. hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])
  30. def test_wext_wpa2_psk(dev, apdev):
  31. """WEXT driver interface with WPA2-PSK"""
  32. if not os.path.exists("/proc/net/wireless"):
  33. logger.info("WEXT support not included in the kernel")
  34. return "skip"
  35. params = hostapd.wpa2_params(ssid="wext-wpa2-psk", passphrase="12345678")
  36. hostapd.add_ap(apdev[0]['ifname'], params)
  37. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  38. try:
  39. wpas.interface_add("wlan5", driver="wext")
  40. except Exception, e:
  41. logger.info("WEXT driver support not included in wpa_supplicant")
  42. return "skip"
  43. wpas.connect("wext-wpa2-psk", psk="12345678")
  44. hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])