Commit graph

10 commits

Author SHA1 Message Date
Preston Hunt
945604a355 Update wpaspy.py to be python3 compatible
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>
2017-02-04 20:57:38 +02:00
Jonathan Afek
93568233bc wpaspy: Fix potentially referencing non existing attribute
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>
2016-05-28 16:34:09 +03:00
Janusz Dziedzic
13073011b9 wpaspy: Add support for TERMINATE command
This can be used to terminate the wpa_supplicant/hostapd process.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2016-03-05 17:44:51 +02:00
Janusz Dziedzic
a2c88a8025 wpaspy: Add support for UDP connection
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>
2016-03-05 17:44:51 +02:00
Jouni Malinen
19318861a5 wpaspy: Handle DETACH response more robustly
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>
2014-04-28 16:54:09 +03:00
Jouni Malinen
c2149b08da tests: Wait longer for hostapd REMOVE command to complete
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>
2014-03-12 11:42:59 +02:00
Jouni Malinen
606110e647 wpaspy: Add optional timeout argument for pending()
This can be used to wait for up to the specified limit on new event
messages.

Signed-hostap: Jouni Malinen <j@w1.fi>
2014-01-07 10:45:10 +02:00
Jouni Malinen
d52747c99e wpaspy: Do not leave socket files behind if connection fails
Ctrl::__init__ needs to handle socket.connect() exceptions and unlink
the client socket file on failures.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 15:45:18 +02:00
Jouni Malinen
b44db5f6d6 wpaspy: Fix tracking of attached status
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>
2013-12-31 09:29:14 +02:00
Jouni Malinen
09491b7392 wpaspy: Add native Python implementation of ctrl_iface access
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>
2013-03-19 01:53:09 +02:00