[RFC] supplicant: Support poll() in eloop.

Jouni Malinen j
Sun Feb 12 11:20:23 PST 2012

On Sun, Feb 12, 2012 at 09:14:21AM -0800, Ben Greear wrote:
> Err, that RFC code had an off-by one bug in it around the code that
> determined when to increase the poll-fd array..did you find
> that, or maybe work around it some other way?

Cannot really say that I did and it didn't even hit my initial test with
large number of sockets. Anyway, I fixed it now before the commit had
even been pushed to the main repository.

The other part that's a bit problematic is the handling of allocation
failures in eloop_sock_table_add_sock(). In practice, that would result
in assert() or NULL pointer deference depending on which allocation

> You probably only hit it when running lots of stations, so
> I can run some tests on whatever is in your tree later next
> week.  (My own code is frozen for release early next week,
> so I can't easily test new stuff until then.)

Yeah, needed to add more sockets and not only that, but to do it in
proper order to get the pollfds_map to the correct size.

While going through some tests, it started to look like this could be
optimized quite a bit by not using the separate map array at all and
just updating pollfds array when sockets are added or removed instead of
doing separately for each poll() call. I wouldn't expect this to make
much of a difference for small number of sockets, but maybe it starts
showing up with huge number.
Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list