Check that the client socket is still open before trying to detach the
control interface to avoid undesired exceptions on cleanup paths on
unexpected errors due to the socket getting closed.
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
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>
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>
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>
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>
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>
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>
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>
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>