This is to avoid having a warning saying that there is no makefile.dep
file, which will be generated right after the warning and then
included in the Makefile.
WSAPoll returns WSAEINVAL when there are no valid sockets in the fdarray
parameter. Individual WSAPOLLFDs can be ignored by setting them to a
negative value (just as with POSIX poll(2)), but there must be at least
one valid (not-ignored) socket to check.
Handled this by either returning error if the error was not EINVAL, or
by checking each WSAPOLLFD in the fdarray; at the first valid one,
return the error, since this was not the reason for the error. If none
are valid, continue, ignoring the error.
Make current loglevel and current log callback global
to the library. Attaching them to the nsock pool doesn't
bring any benefit and prevents from logging activity in
code sections that don't have access to a pool (such as
proxy chain specification parsing).
Updated external calls and nsock tests accordingly.
Entering nsock_loop() with the poll engine activated and no registered FD
(timers only, for instance) should not directly return, but sleep until next
timeout.
Some errors were not properly propagated. Ensure proxy_resolve() returns
a negative error code and make the caller fatal() when unable to complete
proxy_chain initialization for whatever reason.
Report finished (likely failed) events as early as possible. Because the
corresponding IODs can have no I/O activity, they wouldn't be flagged as active
by the I/O engines and the events could end up being delivered at shutdown only
(or never).
Reported by d33tah on http://seclists.org/nmap-dev/2014/q2/409
Only FD_SET and FD_CLR were available. Added a FD_ISSET equivalent.
Implemented them as static inline instead of macros for consistency.
These functions abort() if the FD number is higher than FD_SETSIZE
(except on windows where no check is performed).
This wasn't using Nmap's included libpcap if no options were specified,
instead compiling nsock without pcap support if no libpcap could be
found (which breaks Nmap)