[PATCH V2] Handle EAGAIN in wpa_supplicant_ctrl_iface_send
Dan Williams
dcbw
Wed Sep 25 07:30:30 PDT 2013
On Wed, 2013-09-25 at 16:32 +0300, Jouni Malinen wrote:
> On Mon, Sep 23, 2013 at 10:17:05AM +0200, Pontus Fuchs wrote:
> > If a burst of events are sent, the socket queue can overflow and
> > sendmsg fails with EAGAIN. When this happens the monitor is silently
> > detached.
>
> > diff --git a/wpa_supplicant/ctrl_iface_unix.c b/wpa_supplicant/ctrl_iface_unix.c
> > @@ -623,14 +623,21 @@ static void wpa_supplicant_ctrl_iface_send(const char *ifname, int sock,
> > - if (dst->errors > 1000 ||
> > - (_errno != ENOBUFS && dst->errors > 10) ||
> > - _errno == ENOENT) {
> > + if (dst->errors > 1000 || _errno == ENOENT)
> > + detach = 1;
> > + if (!(_errno == ENOBUFS || _errno == EAGAIN ||
> > + _errno == EWOULDBLOCK) && dst->errors > 10)
> > + detach = 1;
>
> I'm seeing quite bad issues with the control interface sockets reaching
> the maximum send buffer limit and getting stuck in the previous design.
> This change could make this happen even more easily, so I don't think I
> can apply this now. I pushed a workaround patch to recover from this
> state. It is not really nice design, but well, no easy solution for the
> real issue has shown up yet and it may be necessary to do a much larger
> design change to address this cleanly using connection oriented sockets
> rather than a single unconnected socket.
D-Bus! :) </rim shot>
You don't even need a dbus-daemon process running to use the D-Bus
protocol as long as you enforce authorization by checking the socket
peer credentials. All you need is libdbus. If there's interest, that
could certainly be implemented in the supplicant; typically it's just a
private socket somewhere in /var.
Dan
More information about the Hostap
mailing list