wpaspy: Do not mark not-existing UNIX domain socket as UDP

os.stat(path) failure is an ambigious indication of the control
interface "path" type (UDP hostname vs. UNIX domain socket path). The
path may be a valid UNIX domain socket path, but that socket could have
been removed just before reaching here. At least the hwsim test case
concurrent_p2pcli managed to hit the "connect exception" print below
from UDP handling even when using a UNIX domain socket.

Work around incorrect determination of control interface socket type by
assuming anything starting with '/' is a UNIX domain socket and not a
hostname.

Fixes: a2c88a8025 ("wpaspy: Add support for UDP connection")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2021-03-01 12:51:20 +02:00 committed by Jouni Malinen
parent 8d80aa3fca
commit ed14b29f38

View file

@ -21,11 +21,11 @@ class Ctrl:
self.path = path self.path = path
self.port = port self.port = port
self.udp = False
if not path.startswith('/'):
try: try:
mode = os.stat(path).st_mode mode = os.stat(path).st_mode
if stat.S_ISSOCK(mode): if not stat.S_ISSOCK(mode):
self.udp = False
else:
self.udp = True self.udp = True
except: except:
self.udp = True self.udp = True