Nmap Development mailing list archives

Re: Possible bug in ncat 6.01?


From: Alex Weber <alexwebr () gmail com>
Date: Tue, 4 Sep 2012 08:18:39 -0500

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.

-Alex

On 2012-09-04 2:35 AM, "Henri Doreau" <henri.doreau () gmail com> wrote:

2012/9/4 Alex Weber <alexwebr () gmail com>:
I believe I have the problem worked out (the sending socket is
non-blocking, when it really should be blocking) and I have a simple
patch
to fix this issue. I'll clean the patch up and send it to the list
shortly.

-Alex
Hi,

thanks for working on this. Can you elaborate on what you identified
as the cause of the problem? How does the non-blocking behavior break
things?

Regards

--
Henri

Attachment: ncat_core.c.patch
Description:

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

Current thread: