test_wext.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/python
  2. #
  3. # Deprecated WEXT driver interface in wpa_supplicant
  4. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  5. #
  6. # This software may be distributed under the terms of the BSD license.
  7. # See README for more details.
  8. import logging
  9. logger = logging.getLogger()
  10. import os
  11. import hostapd
  12. import hwsim_utils
  13. from wpasupplicant import WpaSupplicant
  14. # It did not look like open mode association completed with WEXT.. Commenting
  15. # this test case out for now. If you care about WEXT, feel free to fix it and
  16. # submit a patch to remove the "REMOVED_" prefix here..
  17. def REMOVED_test_wext_open(dev, apdev):
  18. """WEXT driver interface with open network"""
  19. if not os.path.exists("/proc/net/wireless"):
  20. logger.info("WEXT support not included in the kernel")
  21. return "skip"
  22. params = { "ssid": "wext-open" }
  23. hostapd.add_ap(apdev[0]['ifname'], params)
  24. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  25. try:
  26. wpas.interface_add("wlan5", driver="wext")
  27. except Exception, e:
  28. logger.info("WEXT driver support not included in wpa_supplicant")
  29. return "skip"
  30. wpas.connect("wext-open", key_mgmt="NONE")
  31. hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])
  32. def test_wext_wpa2_psk(dev, apdev):
  33. """WEXT driver interface with WPA2-PSK"""
  34. if not os.path.exists("/proc/net/wireless"):
  35. logger.info("WEXT support not included in the kernel")
  36. return "skip"
  37. params = hostapd.wpa2_params(ssid="wext-wpa2-psk", passphrase="12345678")
  38. hostapd.add_ap(apdev[0]['ifname'], params)
  39. wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
  40. try:
  41. wpas.interface_add("wlan5", driver="wext")
  42. except Exception, e:
  43. logger.info("WEXT driver support not included in wpa_supplicant")
  44. return "skip"
  45. wpas.connect("wext-wpa2-psk", psk="12345678")
  46. hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])