Do not block on ctrl_iface monitor events
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 11 Jul 2013 13:19:19 +0000 (16:19 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 11 Jul 2013 14:04:29 +0000 (17:04 +0300)
It looks like some of the global control interface cases ended up
blocking in sendmsg() when trying to send an event. Since this can block
all wpa_supplicant processing for multiple seconds, this is very
undesirable. Avoid this by requesting sendmsg() to return an error
rather than waiting for the message to be sent.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/ctrl_iface_unix.c

index 1b4b9b0..fc0d649 100644 (file)
@@ -602,7 +602,7 @@ static void wpa_supplicant_ctrl_iface_send(const char *ifname, int sock,
                                    offsetof(struct sockaddr_un, sun_path));
                        msg.msg_name = (void *) &dst->addr;
                        msg.msg_namelen = dst->addrlen;
-                       if (sendmsg(sock, &msg, 0) < 0) {
+                       if (sendmsg(sock, &msg, MSG_DONTWAIT) < 0) {
                                int _errno = errno;
                                wpa_printf(MSG_INFO, "CTRL_IFACE monitor[%d]: "
                                           "%d - %s",