This happens on Windows when two sockets bind to the same local port and
connect to the same remote port on a remote host. I tried this on Linux;
Linux prevents the second bind from succeeding.
http://seclists.org/nmap-dev/2012/q2/513
Otherwise WinSock error numbers are not understood; you get "Unknown
error" instead of "Only one usage of each socket address
(protocol/network address/port) is normally permitted." for example.
It's used two times, in two separate blocks of the function. Therefore it was
declared twice (once per block), then got moved toplevel but the second
declaration was forgotten somehow.
This doesn't actually change anything (identical objdump -d diff) but makes code
nicer.
http://seclists.org/nmap-dev/2012/q3/56. r29134 already addressed the issue but
was incomplete.
This replaces r29134 with an engine-agnostic approach, and additionally enforces
the reset of IOD flags before use or re-use.
that were internally closed and replaced by other ones. This happened during
reconnect attempts.
--
When reconnecting with SSL_OP_NO_SSLv2 (nsock_core.c:472), the libary closes the
fd of the current IOD, and replaces it by a new one.
The man page for epoll_ctl states that a close() on a fd makes it removed from
any epoll set it was in. Therefore, if epoll_ctl(EPOLL_CTL_MOD, ...) returns
ENOENT, we retry with EPOLL_CTL_ADD.
- Always format function name without parens at the beginning of a message.
- Added a nsi_new notification message.
- Only trace the first call to nsi_delete() of a given IOD (i.e. don't log the
calls issued from the resulting callbacks).
Solaris 11 uses BPF packet capture rather than DLPI, which requires
different handling in many cases. The new preprocessor symbol tells when
this is the case; it is additional granularity on top of SOLARIS.
The Nsock select engine stores readiness information in a mask instead
of doing an FD_ISSET against the descriptor every time. This is a good
idea, but it removed a special case in the pre-engines code: in case
PCAP_CAN_DO_SELECT is not defined, we can't do FD_ISSET on the
descriptor because it is -1. Here we check for that occurrence and set
EV_READ in the mask so that a non-blocking pcap read can happen every
iteration.
This was being done manually for various types of events, and not doing
it in every case was causing hard-to-find bugs. See the log messages for
r19970 in /nsock and r28292 in /nmap.
nsock_tod is Nsock's idea of the current time. It is updated when an
nsock_pool is initialized, on each iteration of nsock_loop, and in a few
other places. What could go wrong, with respect to timers, is a sequence
like this:
nsp_new
[... some long delay ...]
nsock_create_timer(timeout)
nsock_loop
The time elapsed after the creatino of the timer until it fires would
not be timeout, but rather timeout - delay. If the delay was long
enough, the timer would fire as loop as nsock_loop was entered.
This showed itself in IPv6 OS detection. We schedule 6 timers
immediately, 100 ms apart. If the pcap_open or anything else took too
long, then the timers would fire all at once. This messed up the
calculation of the TCP_ISR feature.
Perhaps we should do this when any new event is created? It is already
done manually at the beginning of each of the connect functions.
both event sets (events to add and events to remove).
This removes the need callers had to do that filtering, it is safer and makes code
easier to read and maintain.
This section of code is described in a nmap-dev thread, that led to the
development of this patch: http://seclists.org/nmap-dev/2012/q1/243
nsock_core.c:186: update_events: Assertion `(ev_inc & ev_dec) == 0' failed.
Thanks to Ron for reporting the bug and testing.
See: http://seclists.org/nmap-dev/2012/q1/235
This specific connect error is already handled by ultra_scan. A comment
there says it can result from ICMPv6 destination-unreachable
admin-prohibited messages.
support for system-specific scalable IO notification facilities without breaking
portability. This initial version comes with an epoll(7)-based engine for Linux
and a select(2)-based fallback engine for all other operating systems.
This required an important refactoring of the library but the external API was
preserved.
The rewrite also tries to bring the coding standards of nmap to nsock.
See http://labs.unix-junkies.org/nsock_engines.html for the details.
If you have trouble updating after this revision you need to follow
these instructions. You have probably just seen an error like this:
svn: URL 'svn://svn.insecure.org/nping' of existing directory 'nping'
does not match expected URL 'svn://svn.insecure.org/nmap/nping'
This is caused by the replacement of SVN externals.
Here's what you need to do. First, save any local changes you might have
in the nping, nsock, nbase, ncat, and zenmap directories. (For example
by running "cd nping; svn diff > ../nping.diff".) If you don't have any
local changes you can skip this step.
Then run these commands:
rm -rf nping/ nsock/ nbase/ ncat/ zenmap/
svn update
svn cleanup
If all else fails, you can just delete your whole working directory and
check out anew:
svn co --username guest --password "" svn://svn.insecure.org/nmap
There may be further discussion in the mailing list thread at
http://seclists.org/nmap-dev/2011/q4/303.