Nmap Development mailing list archives

Re: Possible bug in ncat 6.01?


From: David Fifield <david () bamsoftware com>
Date: Thu, 6 Sep 2012 11:19:05 -0700

On Tue, Sep 04, 2012 at 08:18:39AM -0500, Alex Weber wrote:
Hi Hani/list,

Sorry! I realize now that wasn't very detailed/helpful - I blame late +
tired :)
What's happening is we're sending quickly enough to exhaust that socket's
send space and occasionally getting a -1, EAGAIN (you can see it in an
strace) in the ncat_broadcast function. That function doesn't handle -1,
EAGAIN and generically treats it as an error that can't be handled - it
writes the error to the console and carries on, dropping any data that
couldn't get sent that time.
I've attached a patch to ncat_core.c - I just set each socket to blocking
before the send, and back to non-blocking after the send. That may mean
Ncat has to block for a moment when sending a lot of data, but I can't
think of a better way to handle it.
It also causes two extra syscalls per send per socket - I don't know if
this will have an appreciable performance impact, just something to
consider.

Thank you for looking into this. I adapted your patch and applied it. I
decided that anything that applies to ncat_broadcast should apply to
ncat_send equally, so I made an auxiliary function that does the
blocking and unblocking.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: