Commit Graph

11 Commits (8df47653277f147a75593ad694cb3873e1a799fc)

Author SHA1 Message Date
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>
8 years ago
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>
8 years ago
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>
8 years ago
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>
10 years ago
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>
10 years ago
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>
11 years ago
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>
11 years ago
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>
11 years ago
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>
11 years ago
Jouni Malinen 15cb4772d6 wpaspy: Fix exception handling in the test script
Signed-hostap: Jouni Malinen <j@w1.fi>
11 years ago
Jouni Malinen 20da5c8986 wpaspy: Add Python bindings for wpa_ctrl
This allows Python to be used to control wpa_supplicant/hostapd through
the control interface.

Signed-hostap: Jouni Malinen <j@w1.fi>
11 years ago