aboutsummaryrefslogtreecommitdiffstats
path: root/wpaspy/wpaspy.py
Commit message (Collapse)AuthorAgeFilesLines
* wpaspy: Convert to/from str to bytes as needed for python3Jouni Malinen2019-02-041-4/+19
| | | | | | | | The control interface commands use mostly ASCII or UTF-8 strings, so convert input/output to strings/bytes as needed for the socket operations with python3. Signed-off-by: Jouni Malinen <j@w1.fi>
* tests: Remove deprecated statement for python3 compatibilityMasashi Honma2019-01-261-2/+0
| | | | | | | | | | This patch is made by using 2to3 command. find . -name *.py | xargs 2to3 -f future -w -n This was not really needed in this file for python2 compatibility. Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
* Update wpaspy.py to be python3 compatiblePreston Hunt2017-02-041-4/+6
| | | | | | | Make minor changes to wpaspy module that enables it to run in either python2 or python3. Signed-off-by: Preston Hunt <preston.hunt@intel.com>
* wpaspy: Fix potentially referencing non existing attributeJonathan Afek2016-05-281-0/+1
| | | | | | | | | | | In wpaspy.py in the Ctrl object constructor there is a try/except. In the except part the code references the s attribute of the object. This attribute is only created later in the try part. If an exception occurs before the attribute creation then the except part references a non existing attribute. Fix that by assigning None to the s attribute at the beginning of the try part. Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
* wpaspy: Add support for TERMINATE commandJanusz Dziedzic2016-03-051-0/+10
| | | | | | This can be used to terminate the wpa_supplicant/hostapd process. Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
* wpaspy: Add support for UDP connectionJanusz Dziedzic2016-03-051-13/+49
| | | | | | | | | | hostname and port can now be specified when using wpaspy.Ctrl, so we can connect to remote clients now. This can also be tested using test.py application with ./test.py <hostname> <port> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
* wpaspy: Handle DETACH response more robustlyJouni Malinen2014-04-281-1/+4
| | | | | | | | | | | | | There could be pending unsolicited event messages on the monitor socket when the DETACH command is issued. As such, the response may be something else then OK even if the actual detach operation succeeded. Try to avoid this be dropping pending messages before issuing the detach command. As an additional workaround, check the response against FAIL instead of requiring OK so that the self.attached does not get left to True incorrectly even if an additional event message were to be received. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* tests: Wait longer for hostapd REMOVE command to completeJouni Malinen2014-03-121-2/+2
| | | | | | | | | | | | | | Some kernel debugging options (especially CONFIG_DEBUG_KOBJECT_RELEASE=y) can add significant blocking time to interface removal with NL80211_CMD_DEL_INTERFACE and SIOCGIFBR(BRCTL_DEL_BRIDGE) block for 1-8 seconds. This could result in the VLAN test cases failing due to a wpaspy timeout on the REMOVE command even though the issue was only in the kernel debugging code making the operations significantly slower. Work around this by using a longer timeout for that control interface command to allow this type of debug kernel to be used. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
* wpaspy: Add optional timeout argument for pending()Jouni Malinen2014-01-071-2/+2
| | | | | | | This can be used to wait for up to the specified limit on new event messages. Signed-hostap: Jouni Malinen <j@w1.fi>
* wpaspy: Do not leave socket files behind if connection failsJouni Malinen2013-12-311-1/+6
| | | | | | | Ctrl::__init__ needs to handle socket.connect() exceptions and unlink the client socket file on failures. Signed-hostap: Jouni Malinen <j@w1.fi>
* wpaspy: Fix tracking of attached statusJouni Malinen2013-12-311-1/+7
| | | | | | | The attached variable was initialized and checked, but never updated. Fix that by updating it on successful ATTACH/DETACH command. Signed-hostap: Jouni Malinen <j@w1.fi>
* wpaspy: Add native Python implementation of ctrl_iface accessJouni Malinen2013-03-181-0/+70
This can be used as a replacement for the wpaspy.c module that uses wpa_ctrl.c to access wpa_supplicant/hostapd control interface. Only the UNIX domain socket version of the control interface is currently supported. Signed-hostap: Jouni Malinen <j@w1.fi>